(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".angie-dev-mode-border-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:99998;pointer-events:none;border:4px solid #ED01EE;box-sizing:border-box}.elementor-editor-active .angie-dev-mode-border-overlay{z-index:1200}body.angie-sidebar-active .angie-dev-mode-border-overlay{left:var(--angie-sidebar-width, 330px)}[dir=rtl] body.angie-sidebar-active .angie-dev-mode-border-overlay,body.angie-sidebar-active[dir=rtl] .angie-dev-mode-border-overlay{left:0;right:var(--angie-sidebar-width, 330px)}html.angie-studio-active .angie-dev-mode-border-overlay{z-index:0}body.angie-sidebar-active #wpadminbar{z-index:99998!important}body:not(.angie-sidebar-active) .angie-dev-mode-border-overlay{z-index:99999!important}")),document.head.appendChild(e)}}catch(d){console.error("vite-plugin-css-injected-by-js",d)}})(); (function(wr){typeof define=="function"&&define.amd?define(wr):wr()})(function(){"use strict";var pfe=Object.defineProperty;var ffe=(wr,Mo,ls)=>Mo in wr?pfe(wr,Mo,{enumerable:!0,configurable:!0,writable:!0,value:ls}):wr[Mo]=ls;var Ce=(wr,Mo,ls)=>ffe(wr,typeof Mo!="symbol"?Mo+"":Mo,ls);var Oo,QD;var wr=typeof document<"u"?document.currentScript:null;function Mo(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const ls="angie-post-install-hide",o2="angie-app",i2="page",s2="open-angie",a2=["oauth2_login_success","oauth2_state","start-oauth"];function d0(e){return e.get(i2)===o2}function l2(e){return a2.some(t=>e.has(t))}function c2(e){return e.origin===window.location.origin&&e.pathname.includes("/wp-admin/")}function u2(e){return e.pathname.endsWith("/post.php")?new URLSearchParams(e.search).get("action")==="elementor":!1}function d2(){if(document.getElementById(ls))return;const e=document.createElement("style");e.id=ls,e.textContent="html{visibility:hidden!important}",(document.head||document.documentElement).appendChild(e)}function p2(){try{const e=new URLSearchParams(window.location.search),t=document.referrer?new URL(document.referrer):null;return!(d0(e)&&!l2(e)&&t!==null&&c2(t)&&u2(t)&&!d0(new URLSearchParams(t.search)))||!t?!1:(t.searchParams.set(s2,"1"),d2(),window.location.replace(t.toString()),!0)}catch(e){return console.debug("Angie post-install-redirect: skipped due to error",e),!1}}typeof window<"u"&&window===window.top&&p2();class f2{constructor(){Ce(this,"errors",[]);Ce(this,"maxSize",100);Ce(this,"initialized",!1);Ce(this,"resourcesCollected",!1)}init(){this.initialized||(window.addEventListener("error",t=>{var r;if(t.target!==window&&t.target instanceof HTMLElement){const o=t.target,i="src"in o&&o.src||"href"in o&&o.href||"";if(!i)return;this.add({timestamp:Date.now(),level:"error",message:`Resource load error: ${i}`})}else this.add({timestamp:Date.now(),level:"error",message:t.message,stack:(r=t.error)==null?void 0:r.stack})},{capture:!0}),window.addEventListener("unhandledrejection",t=>{const n=t.reason instanceof Error?t.reason.message:String(t.reason),r=t.reason instanceof Error?t.reason.stack:void 0;this.add({timestamp:Date.now(),level:"error",message:`Unhandled Promise Rejection: ${n}`,stack:r})}),this.initialized=!0)}collectFailedResources(){if(this.resourcesCollected)return;this.resourcesCollected=!0;const t=performance.getEntriesByType("resource");for(const n of t)n.responseStatus>=400&&(n.initiatorType==="script"||n.initiatorType==="link"||n.initiatorType==="img")&&this.add({timestamp:Date.now(),level:"error",message:`Resource load error: ${n.name}`})}add(t){this.errors.push(t),this.errors.length>this.maxSize&&this.errors.shift()}get(t={}){this.collectFailedResources();let n=[...this.errors];t.since&&(n=n.filter(o=>o.timestamp>t.since));const r=Math.min(t.limit||10,50);return n.slice(-r)}}let Kd=null;function m2(){Kd||(Kd=new f2),Kd.init()}const h2=()=>Kd;var qe;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const i={};for(const s of o)i[s]=s;return i},e.getValidEnumValues=o=>{const i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(const a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(const s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(qe||(qe={}));var p0;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(p0||(p0={}));const de=qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pi=e=>{switch(typeof e){case"undefined":return de.undefined;case"string":return de.string;case"number":return Number.isNaN(e)?de.nan:de.number;case"boolean":return de.boolean;case"function":return de.function;case"bigint":return de.bigint;case"symbol":return de.symbol;case"object":return Array.isArray(e)?de.array:e===null?de.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?de.promise:typeof Map<"u"&&e instanceof Map?de.map:typeof Set<"u"&&e instanceof Set?de.set:typeof Date<"u"&&e instanceof Date?de.date:de.object;default:return de.unknown}},Q=qe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Do extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;ln.message){const n={},r=[];for(const o of this.issues)if(o.path.length>0){const i=o.path[0];n[i]=n[i]||[],n[i].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Do.create=e=>new Do(e);const Zg=(e,t)=>{let n;switch(e.code){case Q.invalid_type:e.received===de.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Q.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,qe.jsonStringifyReplacer)}`;break;case Q.unrecognized_keys:n=`Unrecognized key(s) in object: ${qe.joinValues(e.keys,", ")}`;break;case Q.invalid_union:n="Invalid input";break;case Q.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${qe.joinValues(e.options)}`;break;case Q.invalid_enum_value:n=`Invalid enum value. Expected ${qe.joinValues(e.options)}, received '${e.received}'`;break;case Q.invalid_arguments:n="Invalid function arguments";break;case Q.invalid_return_type:n="Invalid function return type";break;case Q.invalid_date:n="Invalid date";break;case Q.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:qe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Q.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Q.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Q.custom:n="Invalid input";break;case Q.invalid_intersection_types:n="Intersection results could not be merged";break;case Q.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Q.not_finite:n="Number must be finite";break;default:n=t.defaultError,qe.assertNever(e)}return{message:n}};let g2=Zg;function y2(){return g2}const w2=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}};function oe(e,t){const n=y2(),r=w2({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Zg?void 0:Zg].filter(o=>!!o)});e.common.issues.push(r)}class kn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return ke;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const i=await o.key,s=await o.value;r.push({key:i,value:s})}return kn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return ke;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}}const ke=Object.freeze({status:"aborted"}),ac=e=>({status:"dirty",value:e}),vr=e=>({status:"valid",value:e}),f0=e=>e.status==="aborted",m0=e=>e.status==="dirty",ia=e=>e.status==="valid",Zd=e=>typeof Promise<"u"&&e instanceof Promise;var pe;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(pe||(pe={}));class co{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const h0=(e,t)=>{if(ia(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Do(e.common.issues);return this._error=n,this._error}}};function Oe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{const{message:l}=e;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:o}}let Fe=class{get description(){return this._def.description}_getType(t){return pi(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:pi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new kn,ctx:{common:t.parent.common,data:t.data,parsedType:pi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Zd(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pi(t)},o=this._parseSync({data:t,path:r.path,parent:r});return h0(r,o)}"~validate"(t){var r,o;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pi(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return ia(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(o=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>ia(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:pi(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(Zd(o)?o:Promise.resolve(o));return h0(r,i)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const s=t(o),a=()=>i.addIssue({code:Q.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new la({schema:this,typeName:ee.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return jo.create(this,this._def)}nullable(){return ca.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sa.create(this)}promise(){return ep.create(this,this._def)}or(t){return Xd.create([this,t],this._def)}and(t){return Qd.create(this,t,this._def)}transform(t){return new la({...Oe(this._def),schema:this,typeName:ee.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new iy({...Oe(this._def),innerType:this,defaultValue:n,typeName:ee.ZodDefault})}brand(){return new z2({typeName:ee.ZodBranded,type:this,...Oe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new sy({...Oe(this._def),innerType:this,catchValue:n,typeName:ee.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return ay.create(this,t)}readonly(){return ly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const v2=/^c[^\s-]{8,}$/i,_2=/^[0-9a-z]+$/,b2=/^[0-9A-HJKMNP-TV-Z]{26}$/i,E2=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,S2=/^[a-z0-9_-]{21}$/i,T2=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,k2=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,x2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,C2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Yg;const I2=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,P2=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,R2=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,A2=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,O2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,g0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",N2=new RegExp(`^${g0}$`);function y0(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function L2(e){return new RegExp(`^${y0(e)}$`)}function M2(e){let t=`${g0}T${y0(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function D2(e,t){return!!((t==="v4"||!t)&&I2.test(e)||(t==="v6"||!t)&&R2.test(e))}function U2(e,t){if(!T2.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function j2(e,t){return!!((t==="v4"||!t)&&P2.test(e)||(t==="v6"||!t)&&A2.test(e))}let Yd=class Vd extends Fe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==de.string){const i=this._getOrReturnCtx(t);return oe(i,{code:Q.invalid_type,expected:de.string,received:i.parsedType}),ke}const r=new kn;let o;for(const i of this._def.checks)if(i.kind==="min")t.data.lengthi.value&&(o=this._getOrReturnCtx(t,o),oe(o,{code:Q.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const s=t.data.length>i.value,a=t.data.lengtht.test(o),{validation:n,code:Q.invalid_string,...pe.errToObj(r)})}_addCheck(t){return new Vd({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...pe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...pe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...pe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...pe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...pe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...pe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...pe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...pe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...pe.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...pe.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...pe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...pe.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...pe.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...pe.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...pe.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...pe.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...pe.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...pe.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...pe.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...pe.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...pe.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...pe.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...pe.errToObj(n)})}nonempty(t){return this.min(1,pe.errToObj(t))}trim(){return new Vd({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Vd({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Vd({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Yd({checks:[],typeName:ee.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Oe(e)});function W2(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}let Jg=class s0 extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==de.number){const i=this._getOrReturnCtx(t);return oe(i,{code:Q.invalid_type,expected:de.number,received:i.parsedType}),ke}let r;const o=new kn;for(const i of this._def.checks)i.kind==="int"?qe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:Q.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Q.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?W2(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Q.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:Q.not_finite,message:i.message}),o.dirty()):qe.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,pe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,pe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,pe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,pe.toString(n))}setLimit(t,n,r,o){return new s0({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:pe.toString(o)}]})}_addCheck(t){return new s0({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:pe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:pe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:pe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:pe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:pe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:pe.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:pe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:pe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:pe.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&qe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew Jg({checks:[],typeName:ee.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Oe(e)});class lc extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==de.bigint)return this._getInvalidInput(t);let r;const o=new kn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Q.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),oe(r,{code:Q.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):qe.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return oe(n,{code:Q.invalid_type,expected:de.bigint,received:n.parsedType}),ke}gte(t,n){return this.setLimit("min",t,!0,pe.toString(n))}gt(t,n){return this.setLimit("min",t,!1,pe.toString(n))}lte(t,n){return this.setLimit("max",t,!0,pe.toString(n))}lt(t,n){return this.setLimit("max",t,!1,pe.toString(n))}setLimit(t,n,r,o){return new lc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:pe.toString(o)}]})}_addCheck(t){return new lc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:pe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:pe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:pe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:pe.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:pe.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew lc({checks:[],typeName:ee.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Oe(e)});let Xg=class extends Fe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==de.boolean){const r=this._getOrReturnCtx(t);return oe(r,{code:Q.invalid_type,expected:de.boolean,received:r.parsedType}),ke}return vr(t.data)}};Xg.create=e=>new Xg({typeName:ee.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Oe(e)});class Jd extends Fe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==de.date){const i=this._getOrReturnCtx(t);return oe(i,{code:Q.invalid_type,expected:de.date,received:i.parsedType}),ke}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return oe(i,{code:Q.invalid_date}),ke}const r=new kn;let o;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()i.value&&(o=this._getOrReturnCtx(t,o),oe(o,{code:Q.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):qe.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Jd({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:pe.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:pe.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Jd({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ee.ZodDate,...Oe(e)});class w0 extends Fe{_parse(t){if(this._getType(t)!==de.symbol){const r=this._getOrReturnCtx(t);return oe(r,{code:Q.invalid_type,expected:de.symbol,received:r.parsedType}),ke}return vr(t.data)}}w0.create=e=>new w0({typeName:ee.ZodSymbol,...Oe(e)});class v0 extends Fe{_parse(t){if(this._getType(t)!==de.undefined){const r=this._getOrReturnCtx(t);return oe(r,{code:Q.invalid_type,expected:de.undefined,received:r.parsedType}),ke}return vr(t.data)}}v0.create=e=>new v0({typeName:ee.ZodUndefined,...Oe(e)});let _0=class extends Fe{_parse(t){if(this._getType(t)!==de.null){const r=this._getOrReturnCtx(t);return oe(r,{code:Q.invalid_type,expected:de.null,received:r.parsedType}),ke}return vr(t.data)}};_0.create=e=>new _0({typeName:ee.ZodNull,...Oe(e)});class Qg extends Fe{constructor(){super(...arguments),this._any=!0}_parse(t){return vr(t.data)}}Qg.create=e=>new Qg({typeName:ee.ZodAny,...Oe(e)});let ey=class extends Fe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return vr(t.data)}};ey.create=e=>new ey({typeName:ee.ZodUnknown,...Oe(e)});let fi=class extends Fe{_parse(t){const n=this._getOrReturnCtx(t);return oe(n,{code:Q.invalid_type,expected:de.never,received:n.parsedType}),ke}};fi.create=e=>new fi({typeName:ee.ZodNever,...Oe(e)});class b0 extends Fe{_parse(t){if(this._getType(t)!==de.undefined){const r=this._getOrReturnCtx(t);return oe(r,{code:Q.invalid_type,expected:de.void,received:r.parsedType}),ke}return vr(t.data)}}b0.create=e=>new b0({typeName:ee.ZodVoid,...Oe(e)});let sa=class Vg extends Fe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==de.array)return oe(n,{code:Q.invalid_type,expected:de.array,received:n.parsedType}),ke;if(o.exactLength!==null){const s=n.data.length>o.exactLength.value,a=n.data.lengtho.maxLength.value&&(oe(n,{code:Q.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>o.type._parseAsync(new co(n,s,n.path,a)))).then(s=>kn.mergeArray(r,s));const i=[...n.data].map((s,a)=>o.type._parseSync(new co(n,s,n.path,a)));return kn.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Vg({...this._def,minLength:{value:t,message:pe.toString(n)}})}max(t,n){return new Vg({...this._def,maxLength:{value:t,message:pe.toString(n)}})}length(t,n){return new Vg({...this._def,exactLength:{value:t,message:pe.toString(n)}})}nonempty(t){return this.min(1,t)}};sa.create=(e,t)=>new sa({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ee.ZodArray,...Oe(t)});function aa(e){if(e instanceof Uo){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=jo.create(aa(r))}return new Uo({...e._def,shape:()=>t})}else return e instanceof sa?new sa({...e._def,type:aa(e.element)}):e instanceof jo?jo.create(aa(e.unwrap())):e instanceof ca?ca.create(aa(e.unwrap())):e instanceof cs?cs.create(e.items.map(t=>aa(t))):e}let Uo=class ao extends Fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=qe.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==de.object){const c=this._getOrReturnCtx(t);return oe(c,{code:Q.invalid_type,expected:de.object,received:c.parsedType}),ke}const{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof fi&&this._def.unknownKeys==="strip"))for(const c in o.data)s.includes(c)||a.push(c);const l=[];for(const c of s){const u=i[c],d=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new co(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof fi){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")a.length>0&&(oe(o,{code:Q.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new co(o,d,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,p=await u.value;c.push({key:d,value:p,alwaysSet:u.alwaysSet})}return c}).then(c=>kn.mergeObjectSync(r,c)):kn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return pe.errToObj,new ao({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,s;const o=((s=(i=this._def).errorMap)==null?void 0:s.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:pe.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new ao({...this._def,unknownKeys:"strip"})}passthrough(){return new ao({...this._def,unknownKeys:"passthrough"})}extend(t){return new ao({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ao({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ee.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new ao({...this._def,catchall:t})}pick(t){const n={};for(const r of qe.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new ao({...this._def,shape:()=>n})}omit(t){const n={};for(const r of qe.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new ao({...this._def,shape:()=>n})}deepPartial(){return aa(this)}partial(t){const n={};for(const r of qe.objectKeys(this.shape)){const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new ao({...this._def,shape:()=>n})}required(t){const n={};for(const r of qe.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof jo;)i=i._def.innerType;n[r]=i}return new ao({...this._def,shape:()=>n})}keyof(){return S0(qe.objectKeys(this.shape))}};Uo.create=(e,t)=>new Uo({shape:()=>e,unknownKeys:"strip",catchall:fi.create(),typeName:ee.ZodObject,...Oe(t)}),Uo.strictCreate=(e,t)=>new Uo({shape:()=>e,unknownKeys:"strict",catchall:fi.create(),typeName:ee.ZodObject,...Oe(t)}),Uo.lazycreate=(e,t)=>new Uo({shape:e,unknownKeys:"strip",catchall:fi.create(),typeName:ee.ZodObject,...Oe(t)});let Xd=class extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const s=i.map(a=>new Do(a.ctx.common.issues));return oe(n,{code:Q.invalid_union,unionErrors:s}),ke}if(n.common.async)return Promise.all(r.map(async i=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i;const s=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=s.map(l=>new Do(l));return oe(n,{code:Q.invalid_union,unionErrors:a}),ke}}get options(){return this._def.options}};Xd.create=(e,t)=>new Xd({options:e,typeName:ee.ZodUnion,...Oe(t)});function ty(e,t){const n=pi(e),r=pi(t);if(e===t)return{valid:!0,data:e};if(n===de.object&&r===de.object){const o=qe.objectKeys(t),i=qe.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(const a of i){const l=ty(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===de.array&&r===de.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let i=0;i{if(f0(i)||f0(s))return ke;const a=ty(i.value,s.value);return a.valid?((m0(i)||m0(s))&&n.dirty(),{status:n.value,value:a.data}):(oe(r,{code:Q.invalid_intersection_types}),ke)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Qd.create=(e,t,n)=>new Qd({left:e,right:t,typeName:ee.ZodIntersection,...Oe(n)});class cs extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.array)return oe(r,{code:Q.invalid_type,expected:de.array,received:r.parsedType}),ke;if(r.data.lengththis._def.items.length&&(oe(r,{code:Q.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((s,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new co(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>kn.mergeArray(n,s)):kn.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new cs({...this._def,rest:t})}}cs.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new cs({items:e,typeName:ee.ZodTuple,rest:null,...Oe(t)})};let F2=class a0 extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.object)return oe(r,{code:Q.invalid_type,expected:de.object,received:r.parsedType}),ke;const o=[],i=this._def.keyType,s=this._def.valueType;for(const a in r.data)o.push({key:i._parse(new co(r,a,r.path,a)),value:s._parse(new co(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?kn.mergeObjectAsync(n,o):kn.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Fe?new a0({keyType:t,valueType:n,typeName:ee.ZodRecord,...Oe(r)}):new a0({keyType:Yd.create(),valueType:t,typeName:ee.ZodRecord,...Oe(n)})}};class E0 extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.map)return oe(r,{code:Q.invalid_type,expected:de.map,received:r.parsedType}),ke;const o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new co(r,a,r.path,[c,"key"])),value:i._parse(new co(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of s){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ke;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of s){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ke;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}E0.create=(e,t,n)=>new E0({valueType:t,keyType:e,typeName:ee.ZodMap,...Oe(n)});class cc extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==de.set)return oe(r,{code:Q.invalid_type,expected:de.set,received:r.parsedType}),ke;const o=this._def;o.minSize!==null&&r.data.sizeo.maxSize.value&&(oe(r,{code:Q.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function s(l){const c=new Set;for(const u of l){if(u.status==="aborted")return ke;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new co(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new cc({...this._def,minSize:{value:t,message:pe.toString(n)}})}max(t,n){return new cc({...this._def,maxSize:{value:t,message:pe.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}cc.create=(e,t)=>new cc({valueType:e,minSize:null,maxSize:null,typeName:ee.ZodSet,...Oe(t)});class ny extends Fe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}ny.create=(e,t)=>new ny({getter:e,typeName:ee.ZodLazy,...Oe(t)});let ry=class extends Fe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return oe(n,{received:n.data,code:Q.invalid_literal,expected:this._def.value}),ke}return{status:"valid",value:t.data}}get value(){return this._def.value}};ry.create=(e,t)=>new ry({value:e,typeName:ee.ZodLiteral,...Oe(t)});function S0(e,t){return new oy({values:e,typeName:ee.ZodEnum,...Oe(t)})}let oy=class l0 extends Fe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return oe(n,{expected:qe.joinValues(r),received:n.parsedType,code:Q.invalid_type}),ke}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return oe(n,{received:n.data,code:Q.invalid_enum_value,options:r}),ke}return vr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return l0.create(t,{...this._def,...n})}exclude(t,n=this._def){return l0.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};oy.create=S0;class T0 extends Fe{_parse(t){const n=qe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==de.string&&r.parsedType!==de.number){const o=qe.objectValues(n);return oe(r,{expected:qe.joinValues(o),received:r.parsedType,code:Q.invalid_type}),ke}if(this._cache||(this._cache=new Set(qe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=qe.objectValues(n);return oe(r,{received:r.data,code:Q.invalid_enum_value,options:o}),ke}return vr(t.data)}get enum(){return this._def.values}}T0.create=(e,t)=>new T0({values:e,typeName:ee.ZodNativeEnum,...Oe(t)});class ep extends Fe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==de.promise&&n.common.async===!1)return oe(n,{code:Q.invalid_type,expected:de.promise,received:n.parsedType}),ke;const r=n.parsedType===de.promise?n.data:Promise.resolve(n.data);return vr(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ep.create=(e,t)=>new ep({type:e,typeName:ee.ZodPromise,...Oe(t)});class la extends Fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ee.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{oe(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const s=o.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return ke;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?ke:l.status==="dirty"||n.value==="dirty"?ac(l.value):l});{if(n.value==="aborted")return ke;const a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?ke:a.status==="dirty"||n.value==="dirty"?ac(a.value):a}}if(o.type==="refinement"){const s=a=>{const l=o.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ke:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?ke:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ia(s))return ke;const a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>ia(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:n.value,value:a})):ke);qe.assertNever(o)}}la.create=(e,t,n)=>new la({schema:e,typeName:ee.ZodEffects,effect:t,...Oe(n)}),la.createWithPreprocess=(e,t,n)=>new la({schema:t,effect:{type:"preprocess",transform:e},typeName:ee.ZodEffects,...Oe(n)});let jo=class extends Fe{_parse(t){return this._getType(t)===de.undefined?vr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};jo.create=(e,t)=>new jo({innerType:e,typeName:ee.ZodOptional,...Oe(t)});let ca=class extends Fe{_parse(t){return this._getType(t)===de.null?vr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ca.create=(e,t)=>new ca({innerType:e,typeName:ee.ZodNullable,...Oe(t)});let iy=class extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===de.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};iy.create=(e,t)=>new iy({innerType:e,typeName:ee.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Oe(t)});let sy=class extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Zd(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Do(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Do(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};sy.create=(e,t)=>new sy({innerType:e,typeName:ee.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Oe(t)});class k0 extends Fe{_parse(t){if(this._getType(t)!==de.nan){const r=this._getOrReturnCtx(t);return oe(r,{code:Q.invalid_type,expected:de.nan,received:r.parsedType}),ke}return{status:"valid",value:t.data}}}k0.create=e=>new k0({typeName:ee.ZodNaN,...Oe(e)});class z2 extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class ay extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ke:i.status==="dirty"?(n.dirty(),ac(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?ke:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new ay({in:t,out:n,typeName:ee.ZodPipeline})}}let ly=class extends Fe{_parse(t){const n=this._def.innerType._parse(t),r=o=>(ia(o)&&(o.value=Object.freeze(o.value)),o);return Zd(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};ly.create=(e,t)=>new ly({innerType:e,typeName:ee.ZodReadonly,...Oe(t)});var ee;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ee||(ee={}));const b=Yd.create,M=Jg.create,Y=Xg.create,ua=Qg.create,Hr=ey.create;fi.create;const te=sa.create,fe=Uo.create,ie=Xd.create;Qd.create,cs.create;const sn=F2.create,x0=ny.create,B2=ry.create,ve=oy.create;ep.create,jo.create,ca.create;function V(e,t,n){function r(a,l){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(e),t(a,l);for(const u in s.prototype)u in a||Object.defineProperty(a,u,{value:s.prototype[u].bind(a)});a._zod.constr=s,a._zod.def=l}const o=(n==null?void 0:n.Parent)??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var l;const c=n!=null&&n.Parent?new i:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>{var l,c;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class uc extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const C0={};function mi(e){return C0}function I0(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function G2(e,t){return typeof t=="bigint"?t.toString():t}function cy(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function uy(e){return e==null}function dy(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function H2(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}function lt(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function dc(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function pc(e){return JSON.stringify(e)}const P0=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function tp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const q2=cy(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function np(e){if(tp(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(tp(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const V2=new Set(["string","number","symbol"]);function fc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hi(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function me(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function K2(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Z2={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Y2(e,t){const n={},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(n[o]=r.shape[o])}return hi(e,{...e._zod.def,shape:n,checks:[]})}function J2(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete n[o]}return hi(e,{...e._zod.def,shape:n,checks:[]})}function X2(e,t){if(!np(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return dc(this,"shape",r),r},checks:[]};return hi(e,n)}function Q2(e,t){return hi(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return dc(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function eU(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const i in n){if(!(i in r))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(o[i]=e?new e({type:"optional",innerType:r[i]}):r[i])}else for(const i in r)o[i]=e?new e({type:"optional",innerType:r[i]}):r[i];return hi(t,{...t._zod.def,shape:o,checks:[]})}function tU(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const i in n){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(o[i]=new e({type:"nonoptional",innerType:r[i]}))}else for(const i in r)o[i]=new e({type:"nonoptional",innerType:r[i]});return hi(t,{...t._zod.def,shape:o,checks:[]})}function mc(e,t=0){var n;for(let r=t;r{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function rp(e){return typeof e=="string"?e:e==null?void 0:e.message}function gi(e,t,n){var o,i,s,a,l,c;const r={...e,path:e.path??[]};if(!e.message){const u=rp((s=(i=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:i.error)==null?void 0:s.call(i,e))??rp((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??rp((l=n.customError)==null?void 0:l.call(n,e))??rp((c=n.localeError)==null?void 0:c.call(n,e))??"Invalid input";r.message=u}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function py(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function hc(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const R0=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,G2,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},A0=V("$ZodError",R0),op=V("$ZodError",R0,{Parent:Error});function nU(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function rU(e,t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new uc;if(s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>gi(l,i,mi())));throw P0(a,o==null?void 0:o.callee),a}return s.value},oU=$0(op),O0=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>gi(l,i,mi())));throw P0(a,o==null?void 0:o.callee),a}return s.value},iU=O0(op),N0=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new uc;return i.issues.length?{success:!1,error:new(e??A0)(i.issues.map(s=>gi(s,o,mi())))}:{success:!0,data:i.value}},fy=N0(op),L0=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>gi(s,o,mi())))}:{success:!0,data:i.value}},my=L0(op),sU=/^[cC][^\s-]{8,}$/,aU=/^[0-9a-z]+$/,lU=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,cU=/^[0-9a-vA-V]{20}$/,uU=/^[A-Za-z0-9]{27}$/,dU=/^[a-zA-Z0-9_-]{21}$/,pU=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fU=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,M0=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,mU=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,hU="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function gU(){return new RegExp(hU,"u")}const yU=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wU=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,vU=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,_U=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bU=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,D0=/^[A-Za-z0-9_-]*$/,EU=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,SU=/^\+(?:[0-9]){6,14}[0-9]$/,U0="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",TU=new RegExp(`^${U0}$`);function j0(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function kU(e){return new RegExp(`^${j0(e)}$`)}function xU(e){const t=j0({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${U0}T(?:${r})$`)}const CU=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},IU=/^\d+$/,PU=/^-?\d+(?:\.\d+)?/i,RU=/true|false/i,AU=/null/i,$U=/^[^A-Z]*$/,OU=/^[^a-z]*$/,Dn=V("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),W0={number:"number",bigint:"bigint",object:"date"},F0=V("$ZodCheckLessThan",(e,t)=>{Dn.init(e,t);const n=W0[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value{(t.inclusive?r.value<=t.value:r.value{Dn.init(e,t);const n=W0[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),NU=V("$ZodCheckMultipleOf",(e,t)=>{Dn.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):H2(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),LU=V("$ZodCheckNumberFormat",(e,t)=>{var s;Dn.init(e,t),t.format=t.format||"float64";const n=(s=t.format)==null?void 0:s.includes("int"),r=n?"int":"number",[o,i]=Z2[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,n&&(l.pattern=IU)}),e._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:t.format,code:"invalid_type",input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}li&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inst:e})}}),MU=V("$ZodCheckMaxLength",(e,t)=>{var n;Dn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!uy(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{const o=r.value;if(o.length<=t.maximum)return;const s=py(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),DU=V("$ZodCheckMinLength",(e,t)=>{var n;Dn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!uy(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const s=py(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),UU=V("$ZodCheckLengthEquals",(e,t)=>{var n;Dn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!uy(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const s=py(o),a=i>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ip=V("$ZodCheckStringFormat",(e,t)=>{var n,r;Dn.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),jU=V("$ZodCheckRegex",(e,t)=>{ip.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),WU=V("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=$U),ip.init(e,t)}),FU=V("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=OU),ip.init(e,t)}),zU=V("$ZodCheckIncludes",(e,t)=>{Dn.init(e,t);const n=fc(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),BU=V("$ZodCheckStartsWith",(e,t)=>{Dn.init(e,t);const n=new RegExp(`^${fc(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),GU=V("$ZodCheckEndsWith",(e,t)=>{Dn.init(e,t);const n=new RegExp(`.*${fc(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),HU=V("$ZodCheckOverwrite",(e,t)=>{Dn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class qU{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(` `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...n,o.join(` `))}}const VU={major:4,minor:0,patch:0},ct=V("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=VU;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const s of i._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const i=(s,a,l)=>{let c=mc(s),u;for(const d of a){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(c)continue;const p=s.issues.length,m=d._zod.check(s);if(m instanceof Promise&&(l==null?void 0:l.async)===!1)throw new uc;if(u||m instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await m,s.issues.length!==p&&(c||(c=mc(s,p)))});else{if(s.issues.length===p)continue;c||(c=mc(s,p))}}return u?u.then(()=>s):s};e._zod.run=(s,a)=>{const l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new uc;return l.then(c=>i(c,r,a))}return i(l,r,a)}}e["~standard"]={validate:i=>{var s;try{const a=fy(e,i);return a.success?{value:a.data}:{issues:(s=a.error)==null?void 0:s.issues}}catch{return my(e,i).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}}),hy=V("$ZodString",(e,t)=>{var n;ct.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??CU(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),_t=V("$ZodStringFormat",(e,t)=>{ip.init(e,t),hy.init(e,t)}),KU=V("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=fU),_t.init(e,t)}),ZU=V("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=M0(r))}else t.pattern??(t.pattern=M0());_t.init(e,t)}),YU=V("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=mU),_t.init(e,t)}),JU=V("$ZodURL",(e,t)=>{_t.init(e,t),e._zod.check=n=>{try{const r=n.value,o=new URL(r),i=o.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:EU.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!r.endsWith("/")&&i.endsWith("/")?n.value=i.slice(0,-1):n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),XU=V("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=gU()),_t.init(e,t)}),QU=V("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=dU),_t.init(e,t)}),ej=V("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=sU),_t.init(e,t)}),tj=V("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=aU),_t.init(e,t)}),nj=V("$ZodULID",(e,t)=>{t.pattern??(t.pattern=lU),_t.init(e,t)}),rj=V("$ZodXID",(e,t)=>{t.pattern??(t.pattern=cU),_t.init(e,t)}),oj=V("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=uU),_t.init(e,t)}),ij=V("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=xU(t)),_t.init(e,t)}),sj=V("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=TU),_t.init(e,t)}),aj=V("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=kU(t)),_t.init(e,t)}),lj=V("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=pU),_t.init(e,t)}),cj=V("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=yU),_t.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),uj=V("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=wU),_t.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),dj=V("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=vU),_t.init(e,t)}),pj=V("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=_U),_t.init(e,t),e._zod.check=n=>{const[r,o]=n.value.split("/");try{if(!o)throw new Error;const i=Number(o);if(`${i}`!==o)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function B0(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const fj=V("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=bU),_t.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{B0(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function mj(e){if(!D0.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return B0(n)}const hj=V("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=D0),_t.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{mj(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),gj=V("$ZodE164",(e,t)=>{t.pattern??(t.pattern=SU),_t.init(e,t)});function yj(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const wj=V("$ZodJWT",(e,t)=>{_t.init(e,t),e._zod.check=n=>{yj(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),G0=V("$ZodNumber",(e,t)=>{ct.init(e,t),e._zod.pattern=e._zod.bag.pattern??PU,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),vj=V("$ZodNumber",(e,t)=>{LU.init(e,t),G0.init(e,t)}),_j=V("$ZodBoolean",(e,t)=>{ct.init(e,t),e._zod.pattern=RU,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),bj=V("$ZodNull",(e,t)=>{ct.init(e,t),e._zod.pattern=AU,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Ej=V("$ZodUnknown",(e,t)=>{ct.init(e,t),e._zod.parse=n=>n}),Sj=V("$ZodNever",(e,t)=>{ct.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function H0(e,t,n){e.issues.length&&t.issues.push(...us(n,e.issues)),t.value[n]=e.value}const Tj=V("$ZodArray",(e,t)=>{ct.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let s=0;sH0(c,n,s))):H0(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function sp(e,t,n){e.issues.length&&t.issues.push(...us(n,e.issues)),t.value[n]=e.value}function q0(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...us(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const V0=V("$ZodObject",(e,t)=>{ct.init(e,t);const n=cy(()=>{const d=Object.keys(t.shape);for(const m of d)if(!(t.shape[m]instanceof ct))throw new Error(`Invalid element at key "${m}": expected a Zod schema`);const p=K2(t.shape);return{shape:t.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(p)}});lt(e._zod,"propValues",()=>{const d=t.shape,p={};for(const m in d){const h=d[m]._zod;if(h.values){p[m]??(p[m]=new Set);for(const w of h.values)p[m].add(w)}}return p});const r=d=>{const p=new qU(["shape","payload","ctx"]),m=n.value,h=g=>{const y=pc(g);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};p.write("const input = payload.value;");const w=Object.create(null);let v=0;for(const g of m.keys)w[g]=`key_${v++}`;p.write("const newResult = {}");for(const g of m.keys)if(m.optionalKeys.has(g)){const y=w[g];p.write(`const ${y} = ${h(g)};`);const _=pc(g);p.write(` if (${y}.issues.length) { if (input[${_}] === undefined) { if (${_} in input) { newResult[${_}] = undefined; } } else { payload.issues = payload.issues.concat( ${y}.issues.map((iss) => ({ ...iss, path: iss.path ? [${_}, ...iss.path] : [${_}], })) ); } } else if (${y}.value === undefined) { if (${_} in input) newResult[${_}] = undefined; } else { newResult[${_}] = ${y}.value; } `)}else{const y=w[g];p.write(`const ${y} = ${h(g)};`),p.write(` if (${y}.issues.length) payload.issues = payload.issues.concat(${y}.issues.map(iss => ({ ...iss, path: iss.path ? [${pc(g)}, ...iss.path] : [${pc(g)}] })));`),p.write(`newResult[${pc(g)}] = ${y}.value`)}p.write("payload.value = newResult;"),p.write("return payload;");const f=p.compile();return(g,y)=>f(d,g,y)};let o;const i=tp,s=!C0.jitless,l=s&&q2.value,c=t.catchall;let u;e._zod.parse=(d,p)=>{u??(u=n.value);const m=d.value;if(!i(m))return d.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),d;const h=[];if(s&&l&&(p==null?void 0:p.async)===!1&&p.jitless!==!0)o||(o=r(t.shape)),d=o(d,p);else{d.value={};const y=u.shape;for(const _ of u.keys){const E=y[_],S=E._zod.run({value:m[_],issues:[]},p),k=E._zod.optin==="optional"&&E._zod.optout==="optional";S instanceof Promise?h.push(S.then(C=>k?q0(C,d,_,m):sp(C,d,_))):k?q0(S,d,_,m):sp(S,d,_)}}if(!c)return h.length?Promise.all(h).then(()=>d):d;const w=[],v=u.keySet,f=c._zod,g=f.def.type;for(const y of Object.keys(m)){if(v.has(y))continue;if(g==="never"){w.push(y);continue}const _=f.run({value:m[y],issues:[]},p);_ instanceof Promise?h.push(_.then(E=>sp(E,d,y))):sp(_,d,y)}return w.length&&d.issues.push({code:"unrecognized_keys",keys:w,input:m,inst:e}),h.length?Promise.all(h).then(()=>d):d}});function K0(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(i=>gi(i,r,mi())))}),t}const Z0=V("$ZodUnion",(e,t)=>{ct.init(e,t),lt(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),lt(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),lt(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),lt(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>dy(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let o=!1;const i=[];for(const s of t.options){const a=s._zod.run({value:n.value,issues:[]},r);if(a instanceof Promise)i.push(a),o=!0;else{if(a.issues.length===0)return a;i.push(a)}}return o?Promise.all(i).then(s=>K0(s,n,e,r)):K0(i,n,e,r)}}),kj=V("$ZodDiscriminatedUnion",(e,t)=>{Z0.init(e,t);const n=e._zod.parse;lt(e._zod,"propValues",()=>{const o={};for(const i of t.options){const s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[a,l]of Object.entries(s)){o[a]||(o[a]=new Set);for(const c of l)o[a].add(c)}}return o});const r=cy(()=>{const o=t.options,i=new Map;for(const s of o){const a=s._zod.propValues[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const l of a){if(i.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,s)}}return i});e._zod.parse=(o,i)=>{const s=o.value;if(!tp(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const a=r.value.get(s==null?void 0:s[t.discriminator]);return a?a._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[t.discriminator],inst:e}),o)}}),xj=V("$ZodIntersection",(e,t)=>{ct.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([l,c])=>Y0(n,l,c)):Y0(n,i,s)}});function gy(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(np(e)&&np(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const s=gy(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r{ct.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!np(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;n.value={};for(const l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){const c=t.valueType._zod.run({value:o[l],issues:[]},r);c instanceof Promise?i.push(c.then(u=>{u.issues.length&&n.issues.push(...us(l,u.issues)),n.value[l]=u.value})):(c.issues.length&&n.issues.push(...us(l,c.issues)),n.value[l]=c.value)}let a;for(const l in o)s.has(l)||(a=a??[],a.push(l));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const s of Reflect.ownKeys(o)){if(s==="__proto__")continue;const a=t.keyType._zod.run({value:s,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(c=>gi(c,r,mi())),input:s,path:[s],inst:e}),n.value[a.value]=a.value;continue}const l=t.valueType._zod.run({value:o[s],issues:[]},r);l instanceof Promise?i.push(l.then(c=>{c.issues.length&&n.issues.push(...us(s,c.issues)),n.value[a.value]=c.value})):(l.issues.length&&n.issues.push(...us(s,l.issues)),n.value[a.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Ij=V("$ZodEnum",(e,t)=>{ct.init(e,t);const n=I0(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>V2.has(typeof r)).map(r=>typeof r=="string"?fc(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return e._zod.values.has(i)||r.issues.push({code:"invalid_value",values:n,input:i,inst:e}),r}}),Pj=V("$ZodLiteral",(e,t)=>{ct.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?fc(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),Rj=V("$ZodTransform",(e,t)=>{ct.init(e,t),e._zod.parse=(n,r)=>{const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new uc;return n.value=o,n}}),Aj=V("$ZodOptional",(e,t)=>{ct.init(e,t),e._zod.optin="optional",e._zod.optout="optional",lt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),lt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${dy(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,r):n.value===void 0?n:t.innerType._zod.run(n,r)}),$j=V("$ZodNullable",(e,t)=>{ct.init(e,t),lt(e._zod,"optin",()=>t.innerType._zod.optin),lt(e._zod,"optout",()=>t.innerType._zod.optout),lt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${dy(n.source)}|null)$`):void 0}),lt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Oj=V("$ZodDefault",(e,t)=>{ct.init(e,t),e._zod.optin="optional",lt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>J0(i,t)):J0(o,t)}});function J0(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Nj=V("$ZodPrefault",(e,t)=>{ct.init(e,t),e._zod.optin="optional",lt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Lj=V("$ZodNonOptional",(e,t)=>{ct.init(e,t),lt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>X0(i,e)):X0(o,e)}});function X0(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Mj=V("$ZodCatch",(e,t)=>{ct.init(e,t),e._zod.optin="optional",lt(e._zod,"optout",()=>t.innerType._zod.optout),lt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>gi(s,r,mi()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>gi(i,r,mi()))},input:n.value}),n.issues=[]),n)}}),Dj=V("$ZodPipe",(e,t)=>{ct.init(e,t),lt(e._zod,"values",()=>t.in._zod.values),lt(e._zod,"optin",()=>t.in._zod.optin),lt(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Q0(i,t,r)):Q0(o,t,r)}});function Q0(e,t,n){return mc(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const Uj=V("$ZodReadonly",(e,t)=>{ct.init(e,t),lt(e._zod,"propValues",()=>t.innerType._zod.propValues),lt(e._zod,"values",()=>t.innerType._zod.values),lt(e._zod,"optin",()=>t.innerType._zod.optin),lt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(eT):eT(o)}});function eT(e){return e.value=Object.freeze(e.value),e}const jj=V("$ZodCustom",(e,t)=>{Dn.init(e,t),ct.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>tT(i,n,r,e));tT(o,n,r,e)}});function tT(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(hc(o))}}class nT{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function Wj(){return new nT}const gc=Wj();function Fj(e,t){return new e({type:"string",...me(t)})}function zj(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...me(t)})}function rT(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...me(t)})}function Bj(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...me(t)})}function Gj(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...me(t)})}function Hj(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...me(t)})}function qj(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...me(t)})}function Vj(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...me(t)})}function Kj(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...me(t)})}function Zj(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...me(t)})}function Yj(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...me(t)})}function Jj(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...me(t)})}function Xj(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...me(t)})}function Qj(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...me(t)})}function eW(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...me(t)})}function tW(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...me(t)})}function nW(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...me(t)})}function rW(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...me(t)})}function oW(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...me(t)})}function iW(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...me(t)})}function sW(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...me(t)})}function aW(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...me(t)})}function lW(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...me(t)})}function cW(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...me(t)})}function uW(e,t){return new e({type:"string",format:"date",check:"string_format",...me(t)})}function dW(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...me(t)})}function pW(e,t){return new e({type:"string",format:"duration",check:"string_format",...me(t)})}function fW(e,t){return new e({type:"number",checks:[],...me(t)})}function mW(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...me(t)})}function hW(e,t){return new e({type:"boolean",...me(t)})}function gW(e,t){return new e({type:"null",...me(t)})}function yW(e){return new e({type:"unknown"})}function wW(e,t){return new e({type:"never",...me(t)})}function oT(e,t){return new F0({check:"less_than",...me(t),value:e,inclusive:!1})}function yy(e,t){return new F0({check:"less_than",...me(t),value:e,inclusive:!0})}function iT(e,t){return new z0({check:"greater_than",...me(t),value:e,inclusive:!1})}function wy(e,t){return new z0({check:"greater_than",...me(t),value:e,inclusive:!0})}function sT(e,t){return new NU({check:"multiple_of",...me(t),value:e})}function aT(e,t){return new MU({check:"max_length",...me(t),maximum:e})}function ap(e,t){return new DU({check:"min_length",...me(t),minimum:e})}function lT(e,t){return new UU({check:"length_equals",...me(t),length:e})}function vW(e,t){return new jU({check:"string_format",format:"regex",...me(t),pattern:e})}function _W(e){return new WU({check:"string_format",format:"lowercase",...me(e)})}function bW(e){return new FU({check:"string_format",format:"uppercase",...me(e)})}function EW(e,t){return new zU({check:"string_format",format:"includes",...me(t),includes:e})}function SW(e,t){return new BU({check:"string_format",format:"starts_with",...me(t),prefix:e})}function TW(e,t){return new GU({check:"string_format",format:"ends_with",...me(t),suffix:e})}function yc(e){return new HU({check:"overwrite",tx:e})}function kW(e){return yc(t=>t.normalize(e))}function xW(){return yc(e=>e.trim())}function CW(){return yc(e=>e.toLowerCase())}function IW(){return yc(e=>e.toUpperCase())}function PW(e,t,n){return new e({type:"array",element:t,...me(n)})}function RW(e,t,n){const r=me(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function AW(e,t,n){return new e({type:"custom",check:"custom",fn:t,...me(n)})}class cT{constructor(t){this.counter=0,this.metadataRegistry=(t==null?void 0:t.metadata)??gc,this.target=(t==null?void 0:t.target)??"draft-2020-12",this.unrepresentable=(t==null?void 0:t.unrepresentable)??"throw",this.override=(t==null?void 0:t.override)??(()=>{}),this.io=(t==null?void 0:t.io)??"output",this.seen=new Map}process(t,n={path:[],schemaPath:[]}){var d,p,m;var r;const o=t._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(t,a);const l=(p=(d=t._zod).toJSONSchema)==null?void 0:p.call(d);if(l)a.schema=l;else{const h={...n,schemaPath:[...n.schemaPath,t],path:n.path},w=t._zod.parent;if(w)a.ref=w,this.process(w,h),this.seen.get(w).isParent=!0;else{const v=a.schema;switch(o.type){case"string":{const f=v;f.type="string";const{minimum:g,maximum:y,format:_,patterns:E,contentEncoding:S}=t._zod.bag;if(typeof g=="number"&&(f.minLength=g),typeof y=="number"&&(f.maxLength=y),_&&(f.format=i[_]??_,f.format===""&&delete f.format),S&&(f.contentEncoding=S),E&&E.size>0){const k=[...E];k.length===1?f.pattern=k[0].source:k.length>1&&(a.schema.allOf=[...k.map(C=>({...this.target==="draft-7"?{type:"string"}:{},pattern:C.source}))])}break}case"number":{const f=v,{minimum:g,maximum:y,format:_,multipleOf:E,exclusiveMaximum:S,exclusiveMinimum:k}=t._zod.bag;typeof _=="string"&&_.includes("int")?f.type="integer":f.type="number",typeof k=="number"&&(f.exclusiveMinimum=k),typeof g=="number"&&(f.minimum=g,typeof k=="number"&&(k>=g?delete f.minimum:delete f.exclusiveMinimum)),typeof S=="number"&&(f.exclusiveMaximum=S),typeof y=="number"&&(f.maximum=y,typeof S=="number"&&(S<=y?delete f.maximum:delete f.exclusiveMaximum)),typeof E=="number"&&(f.multipleOf=E);break}case"boolean":{const f=v;f.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{v.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{v.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const f=v,{minimum:g,maximum:y}=t._zod.bag;typeof g=="number"&&(f.minItems=g),typeof y=="number"&&(f.maxItems=y),f.type="array",f.items=this.process(o.element,{...h,path:[...h.path,"items"]});break}case"object":{const f=v;f.type="object",f.properties={};const g=o.shape;for(const E in g)f.properties[E]=this.process(g[E],{...h,path:[...h.path,"properties",E]});const y=new Set(Object.keys(g)),_=new Set([...y].filter(E=>{const S=o.shape[E]._zod;return this.io==="input"?S.optin===void 0:S.optout===void 0}));_.size>0&&(f.required=Array.from(_)),((m=o.catchall)==null?void 0:m._zod.def.type)==="never"?f.additionalProperties=!1:o.catchall?o.catchall&&(f.additionalProperties=this.process(o.catchall,{...h,path:[...h.path,"additionalProperties"]})):this.io==="output"&&(f.additionalProperties=!1);break}case"union":{const f=v;f.anyOf=o.options.map((g,y)=>this.process(g,{...h,path:[...h.path,"anyOf",y]}));break}case"intersection":{const f=v,g=this.process(o.left,{...h,path:[...h.path,"allOf",0]}),y=this.process(o.right,{...h,path:[...h.path,"allOf",1]}),_=S=>"allOf"in S&&Object.keys(S).length===1,E=[..._(g)?g.allOf:[g],..._(y)?y.allOf:[y]];f.allOf=E;break}case"tuple":{const f=v;f.type="array";const g=o.items.map((E,S)=>this.process(E,{...h,path:[...h.path,"prefixItems",S]}));if(this.target==="draft-2020-12"?f.prefixItems=g:f.items=g,o.rest){const E=this.process(o.rest,{...h,path:[...h.path,"items"]});this.target==="draft-2020-12"?f.items=E:f.additionalItems=E}o.rest&&(f.items=this.process(o.rest,{...h,path:[...h.path,"items"]}));const{minimum:y,maximum:_}=t._zod.bag;typeof y=="number"&&(f.minItems=y),typeof _=="number"&&(f.maxItems=_);break}case"record":{const f=v;f.type="object",f.propertyNames=this.process(o.keyType,{...h,path:[...h.path,"propertyNames"]}),f.additionalProperties=this.process(o.valueType,{...h,path:[...h.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const f=v,g=I0(o.entries);g.every(y=>typeof y=="number")&&(f.type="number"),g.every(y=>typeof y=="string")&&(f.type="string"),f.enum=g;break}case"literal":{const f=v,g=[];for(const y of o.values)if(y===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof y=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");g.push(Number(y))}else g.push(y);if(g.length!==0)if(g.length===1){const y=g[0];f.type=y===null?"null":typeof y,f.const=y}else g.every(y=>typeof y=="number")&&(f.type="number"),g.every(y=>typeof y=="string")&&(f.type="string"),g.every(y=>typeof y=="boolean")&&(f.type="string"),g.every(y=>y===null)&&(f.type="null"),f.enum=g;break}case"file":{const f=v,g={type:"string",format:"binary",contentEncoding:"binary"},{minimum:y,maximum:_,mime:E}=t._zod.bag;y!==void 0&&(g.minLength=y),_!==void 0&&(g.maxLength=_),E?E.length===1?(g.contentMediaType=E[0],Object.assign(f,g)):f.anyOf=E.map(S=>({...g,contentMediaType:S})):Object.assign(f,g);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const f=this.process(o.innerType,h);v.anyOf=[f,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,h),a.ref=o.innerType;break}case"success":{const f=v;f.type="boolean";break}case"default":{this.process(o.innerType,h),a.ref=o.innerType,v.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,h),a.ref=o.innerType,this.io==="input"&&(v._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,h),a.ref=o.innerType;let f;try{f=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}v.default=f;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const f=v,g=t._zod.pattern;if(!g)throw new Error("Pattern not found in template literal");f.type="string",f.pattern=g.source;break}case"pipe":{const f=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(f,h),a.ref=f;break}case"readonly":{this.process(o.innerType,h),a.ref=o.innerType,v.readOnly=!0;break}case"promise":{this.process(o.innerType,h),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,h),a.ref=o.innerType;break}case"lazy":{const f=t._zod.innerType;this.process(f,h),a.ref=f;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const c=this.metadataRegistry.get(t);return c&&Object.assign(a.schema,c),this.io==="input"&&Ht(t)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(t).schema}emit(t,n){var u,d,p,m,h,w;const r={cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0},o=this.seen.get(t);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=v=>{var E;const f=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const S=(E=r.external.registry.get(v[0]))==null?void 0:E.id,k=r.external.uri??(O=>O);if(S)return{ref:k(S)};const C=v[1].defId??v[1].schema.id??`schema${this.counter++}`;return v[1].defId=C,{defId:C,ref:`${k("__shared")}#/${f}/${C}`}}if(v[1]===o)return{ref:"#"};const y=`#/${f}/`,_=v[1].schema.id??`__schema${this.counter++}`;return{defId:_,ref:y+_}},s=v=>{if(v[1].schema.$ref)return;const f=v[1],{ref:g,defId:y}=i(v);f.def={...f.schema},y&&(f.defId=y);const _=f.schema;for(const E in _)delete _[E];_.$ref=g};if(r.cycles==="throw")for(const v of this.seen.entries()){const f=v[1];if(f.cycle)throw new Error(`Cycle detected: #/${(u=f.cycle)==null?void 0:u.join("/")}/ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const v of this.seen.entries()){const f=v[1];if(t===v[0]){s(v);continue}if(r.external){const y=(d=r.external.registry.get(v[0]))==null?void 0:d.id;if(t!==v[0]&&y){s(v);continue}}if((p=this.metadataRegistry.get(v[0]))==null?void 0:p.id){s(v);continue}if(f.cycle){s(v);continue}if(f.count>1&&r.reused==="ref"){s(v);continue}}const a=(v,f)=>{const g=this.seen.get(v),y=g.def??g.schema,_={...y};if(g.ref===null)return;const E=g.ref;if(g.ref=null,E){a(E,f);const S=this.seen.get(E).schema;S.$ref&&f.target==="draft-7"?(y.allOf=y.allOf??[],y.allOf.push(S)):(Object.assign(y,S),Object.assign(y,_))}g.isParent||this.override({zodSchema:v,jsonSchema:y,path:g.path??[]})};for(const v of[...this.seen.entries()].reverse())a(v[0],{target:this.target});const l={};if(this.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?l.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),(m=r.external)!=null&&m.uri){const v=(h=r.external.registry.get(t))==null?void 0:h.id;if(!v)throw new Error("Schema is missing an `id` property");l.$id=r.external.uri(v)}Object.assign(l,o.def);const c=((w=r.external)==null?void 0:w.defs)??{};for(const v of this.seen.entries()){const f=v[1];f.def&&f.defId&&(c[f.defId]=f.def)}r.external||Object.keys(c).length>0&&(this.target==="draft-2020-12"?l.$defs=c:l.definitions=c);try{return JSON.parse(JSON.stringify(l))}catch{throw new Error("Error converting schema to JSON.")}}}function $W(e,t){if(e instanceof nT){const r=new cT(t),o={};for(const a of e._idmap.entries()){const[l,c]=a;r.process(c)}const i={},s={registry:e,uri:t==null?void 0:t.uri,defs:o};for(const a of e._idmap.entries()){const[l,c]=a;i[l]=r.emit(c,{...t,external:s})}if(Object.keys(o).length>0){const a=r.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}const n=new cT(t);return n.process(e),n.emit(e,t)}function Ht(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Ht(o.element,n);case"object":{for(const i in o.shape)if(Ht(o.shape[i],n))return!0;return!1}case"union":{for(const i of o.options)if(Ht(i,n))return!0;return!1}case"intersection":return Ht(o.left,n)||Ht(o.right,n);case"tuple":{for(const i of o.items)if(Ht(i,n))return!0;return!!(o.rest&&Ht(o.rest,n))}case"record":return Ht(o.keyType,n)||Ht(o.valueType,n);case"map":return Ht(o.keyType,n)||Ht(o.valueType,n);case"set":return Ht(o.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Ht(o.innerType,n);case"lazy":return Ht(o.getter(),n);case"default":return Ht(o.innerType,n);case"prefault":return Ht(o.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return Ht(o.in,n)||Ht(o.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${o.type}`)}const OW=V("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");ct.init(e,t),e.def=t,e.parse=(n,r)=>oU(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>fy(e,n,r),e.parseAsync=async(n,r)=>iU(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>my(e,n,r),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>hi(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e)}),NW=V("ZodMiniObject",(e,t)=>{V0.init(e,t),OW.init(e,t),lt(e,"shape",()=>t.shape)});function uT(e,t){const n={type:"object",get shape(){return dc(this,"shape",{...e}),this.shape},...me(t)};return new NW(n)}function uo(e){return!!e._zod}function da(e){const t=Object.values(e);if(t.length===0)return uT({});const n=t.every(uo),r=t.every(o=>!uo(o));if(n)return uT(e);if(r)return fe(e);throw new Error("Mixed Zod versions detected in object shape.")}function wc(e,t){return uo(e)?fy(e,t):e.safeParse(t)}async function vy(e,t){return uo(e)?await my(e,t):await e.safeParseAsync(t)}function vc(e){var n,r;if(!e)return;let t;if(uo(e)?t=(r=(n=e._zod)==null?void 0:n.def)==null?void 0:r.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function _c(e){var t;if(e){if(typeof e=="object"){const n=e,r=e;if(!n._def&&!r._zod){const o=Object.values(e);if(o.length>0&&o.every(i=>typeof i=="object"&&i!==null&&(i._def!==void 0||i._zod!==void 0||typeof i.parse=="function")))return da(e)}}if(uo(e)){const r=(t=e._zod)==null?void 0:t.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e}}function _y(e){if(e&&typeof e=="object"){if("message"in e&&typeof e.message=="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){const t=e.issues[0];if(t&&typeof t=="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function LW(e){return e.description}function MW(e){var n,r,o;if(uo(e))return((r=(n=e._zod)==null?void 0:n.def)==null?void 0:r.type)==="optional";const t=e;return typeof e.isOptional=="function"?e.isOptional():((o=t._def)==null?void 0:o.typeName)==="ZodOptional"}function dT(e){var o;if(uo(e)){const s=(o=e._zod)==null?void 0:o.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}const n=e._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}const r=e.value;if(r!==void 0)return r}const DW=V("ZodISODateTime",(e,t)=>{ij.init(e,t),kt.init(e,t)});function pT(e){return cW(DW,e)}const UW=V("ZodISODate",(e,t)=>{sj.init(e,t),kt.init(e,t)});function jW(e){return uW(UW,e)}const WW=V("ZodISOTime",(e,t)=>{aj.init(e,t),kt.init(e,t)});function FW(e){return dW(WW,e)}const zW=V("ZodISODuration",(e,t)=>{lj.init(e,t),kt.init(e,t)});function BW(e){return pW(zW,e)}const lp=V("ZodError",(e,t)=>{A0.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>rU(e,n)},flatten:{value:n=>nU(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),GW=$0(lp),HW=O0(lp),qW=N0(lp),VW=L0(lp),Tt=V("ZodType",(e,t)=>(ct.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>hi(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>GW(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>qW(e,n,r),e.parseAsync=async(n,r)=>HW(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>VW(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(DF(n,r)),e.superRefine=n=>e.check(UF(n)),e.overwrite=n=>e.check(yc(n)),e.optional=()=>Nt(e),e.nullable=()=>ST(e),e.nullish=()=>Nt(ST(e)),e.nonoptional=n=>PF(e,n),e.array=()=>Ge(e),e.or=n=>pt([e,n]),e.and=n=>by(e,n),e.transform=n=>Sy(e,bT(n)),e.default=n=>xF(e,n),e.prefault=n=>IF(e,n),e.catch=n=>AF(e,n),e.pipe=n=>Sy(e,n),e.readonly=()=>NF(e),e.describe=n=>{const r=e.clone();return gc.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=gc.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return gc.get(e);const r=e.clone();return gc.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),fT=V("_ZodString",(e,t)=>{hy.init(e,t),Tt.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(vW(...r)),e.includes=(...r)=>e.check(EW(...r)),e.startsWith=(...r)=>e.check(SW(...r)),e.endsWith=(...r)=>e.check(TW(...r)),e.min=(...r)=>e.check(ap(...r)),e.max=(...r)=>e.check(aT(...r)),e.length=(...r)=>e.check(lT(...r)),e.nonempty=(...r)=>e.check(ap(1,...r)),e.lowercase=r=>e.check(_W(r)),e.uppercase=r=>e.check(bW(r)),e.trim=()=>e.check(xW()),e.normalize=(...r)=>e.check(kW(...r)),e.toLowerCase=()=>e.check(CW()),e.toUpperCase=()=>e.check(IW())}),KW=V("ZodString",(e,t)=>{hy.init(e,t),fT.init(e,t),e.email=n=>e.check(zj(ZW,n)),e.url=n=>e.check(Vj(YW,n)),e.jwt=n=>e.check(lW(dF,n)),e.emoji=n=>e.check(Kj(JW,n)),e.guid=n=>e.check(rT(mT,n)),e.uuid=n=>e.check(Bj(cp,n)),e.uuidv4=n=>e.check(Gj(cp,n)),e.uuidv6=n=>e.check(Hj(cp,n)),e.uuidv7=n=>e.check(qj(cp,n)),e.nanoid=n=>e.check(Zj(XW,n)),e.guid=n=>e.check(rT(mT,n)),e.cuid=n=>e.check(Yj(QW,n)),e.cuid2=n=>e.check(Jj(eF,n)),e.ulid=n=>e.check(Xj(tF,n)),e.base64=n=>e.check(iW(lF,n)),e.base64url=n=>e.check(sW(cF,n)),e.xid=n=>e.check(Qj(nF,n)),e.ksuid=n=>e.check(eW(rF,n)),e.ipv4=n=>e.check(tW(oF,n)),e.ipv6=n=>e.check(nW(iF,n)),e.cidrv4=n=>e.check(rW(sF,n)),e.cidrv6=n=>e.check(oW(aF,n)),e.e164=n=>e.check(aW(uF,n)),e.datetime=n=>e.check(pT(n)),e.date=n=>e.check(jW(n)),e.time=n=>e.check(FW(n)),e.duration=n=>e.check(BW(n))});function H(e){return Fj(KW,e)}const kt=V("ZodStringFormat",(e,t)=>{_t.init(e,t),fT.init(e,t)}),ZW=V("ZodEmail",(e,t)=>{YU.init(e,t),kt.init(e,t)}),mT=V("ZodGUID",(e,t)=>{KU.init(e,t),kt.init(e,t)}),cp=V("ZodUUID",(e,t)=>{ZU.init(e,t),kt.init(e,t)}),YW=V("ZodURL",(e,t)=>{JU.init(e,t),kt.init(e,t)}),JW=V("ZodEmoji",(e,t)=>{XU.init(e,t),kt.init(e,t)}),XW=V("ZodNanoID",(e,t)=>{QU.init(e,t),kt.init(e,t)}),QW=V("ZodCUID",(e,t)=>{ej.init(e,t),kt.init(e,t)}),eF=V("ZodCUID2",(e,t)=>{tj.init(e,t),kt.init(e,t)}),tF=V("ZodULID",(e,t)=>{nj.init(e,t),kt.init(e,t)}),nF=V("ZodXID",(e,t)=>{rj.init(e,t),kt.init(e,t)}),rF=V("ZodKSUID",(e,t)=>{oj.init(e,t),kt.init(e,t)}),oF=V("ZodIPv4",(e,t)=>{cj.init(e,t),kt.init(e,t)}),iF=V("ZodIPv6",(e,t)=>{uj.init(e,t),kt.init(e,t)}),sF=V("ZodCIDRv4",(e,t)=>{dj.init(e,t),kt.init(e,t)}),aF=V("ZodCIDRv6",(e,t)=>{pj.init(e,t),kt.init(e,t)}),lF=V("ZodBase64",(e,t)=>{fj.init(e,t),kt.init(e,t)}),cF=V("ZodBase64URL",(e,t)=>{hj.init(e,t),kt.init(e,t)}),uF=V("ZodE164",(e,t)=>{gj.init(e,t),kt.init(e,t)}),dF=V("ZodJWT",(e,t)=>{wj.init(e,t),kt.init(e,t)}),hT=V("ZodNumber",(e,t)=>{G0.init(e,t),Tt.init(e,t),e.gt=(r,o)=>e.check(iT(r,o)),e.gte=(r,o)=>e.check(wy(r,o)),e.min=(r,o)=>e.check(wy(r,o)),e.lt=(r,o)=>e.check(oT(r,o)),e.lte=(r,o)=>e.check(yy(r,o)),e.max=(r,o)=>e.check(yy(r,o)),e.int=r=>e.check(gT(r)),e.safe=r=>e.check(gT(r)),e.positive=r=>e.check(iT(0,r)),e.nonnegative=r=>e.check(wy(0,r)),e.negative=r=>e.check(oT(0,r)),e.nonpositive=r=>e.check(yy(0,r)),e.multipleOf=(r,o)=>e.check(sT(r,o)),e.step=(r,o)=>e.check(sT(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function nt(e){return fW(hT,e)}const pF=V("ZodNumberFormat",(e,t)=>{vj.init(e,t),hT.init(e,t)});function gT(e){return mW(pF,e)}const fF=V("ZodBoolean",(e,t)=>{_j.init(e,t),Tt.init(e,t)});function an(e){return hW(fF,e)}const mF=V("ZodNull",(e,t)=>{bj.init(e,t),Tt.init(e,t)});function yT(e){return gW(mF,e)}const hF=V("ZodUnknown",(e,t)=>{Ej.init(e,t),Tt.init(e,t)});function xt(){return yW(hF)}const gF=V("ZodNever",(e,t)=>{Sj.init(e,t),Tt.init(e,t)});function yF(e){return wW(gF,e)}const wF=V("ZodArray",(e,t)=>{Tj.init(e,t),Tt.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(ap(n,r)),e.nonempty=n=>e.check(ap(1,n)),e.max=(n,r)=>e.check(aT(n,r)),e.length=(n,r)=>e.check(lT(n,r)),e.unwrap=()=>e.element});function Ge(e,t){return PW(wF,e,t)}const wT=V("ZodObject",(e,t)=>{V0.init(e,t),Tt.init(e,t),lt(e,"shape",()=>t.shape),e.keyof=()=>tr(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:xt()}),e.loose=()=>e.clone({...e._zod.def,catchall:xt()}),e.strict=()=>e.clone({...e._zod.def,catchall:yF()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>X2(e,n),e.merge=n=>Q2(e,n),e.pick=n=>Y2(e,n),e.omit=n=>J2(e,n),e.partial=(...n)=>eU(ET,e,n[0]),e.required=(...n)=>tU(TT,e,n[0])});function le(e,t){const n={type:"object",get shape(){return dc(this,"shape",{...e}),this.shape},...me(t)};return new wT(n)}function Un(e,t){return new wT({type:"object",get shape(){return dc(this,"shape",{...e}),this.shape},catchall:xt(),...me(t)})}const vT=V("ZodUnion",(e,t)=>{Z0.init(e,t),Tt.init(e,t),e.options=t.options});function pt(e,t){return new vT({type:"union",options:e,...me(t)})}const vF=V("ZodDiscriminatedUnion",(e,t)=>{vT.init(e,t),kj.init(e,t)});function _T(e,t,n){return new vF({type:"union",options:t,discriminator:e,...me(n)})}const _F=V("ZodIntersection",(e,t)=>{xj.init(e,t),Tt.init(e,t)});function by(e,t){return new _F({type:"intersection",left:e,right:t})}const bF=V("ZodRecord",(e,t)=>{Cj.init(e,t),Tt.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Ct(e,t,n){return new bF({type:"record",keyType:e,valueType:t,...me(n)})}const Ey=V("ZodEnum",(e,t)=>{Ij.init(e,t),Tt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Ey({...t,checks:[],...me(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Ey({...t,checks:[],...me(o),entries:i})}});function tr(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ey({type:"enum",entries:n,...me(t)})}const EF=V("ZodLiteral",(e,t)=>{Pj.init(e,t),Tt.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ye(e,t){return new EF({type:"literal",values:Array.isArray(e)?e:[e],...me(t)})}const SF=V("ZodTransform",(e,t)=>{Rj.init(e,t),Tt.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=i=>{if(typeof i=="string")n.issues.push(hc(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),s.continue??(s.continue=!0),n.issues.push(hc(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function bT(e){return new SF({type:"transform",transform:e})}const ET=V("ZodOptional",(e,t)=>{Aj.init(e,t),Tt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Nt(e){return new ET({type:"optional",innerType:e})}const TF=V("ZodNullable",(e,t)=>{$j.init(e,t),Tt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ST(e){return new TF({type:"nullable",innerType:e})}const kF=V("ZodDefault",(e,t)=>{Oj.init(e,t),Tt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function xF(e,t){return new kF({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const CF=V("ZodPrefault",(e,t)=>{Nj.init(e,t),Tt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function IF(e,t){return new CF({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const TT=V("ZodNonOptional",(e,t)=>{Lj.init(e,t),Tt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function PF(e,t){return new TT({type:"nonoptional",innerType:e,...me(t)})}const RF=V("ZodCatch",(e,t)=>{Mj.init(e,t),Tt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function AF(e,t){return new RF({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const $F=V("ZodPipe",(e,t)=>{Dj.init(e,t),Tt.init(e,t),e.in=t.in,e.out=t.out});function Sy(e,t){return new $F({type:"pipe",in:e,out:t})}const OF=V("ZodReadonly",(e,t)=>{Uj.init(e,t),Tt.init(e,t)});function NF(e){return new OF({type:"readonly",innerType:e})}const kT=V("ZodCustom",(e,t)=>{jj.init(e,t),Tt.init(e,t)});function LF(e){const t=new Dn({check:"custom"});return t._zod.check=e,t}function MF(e,t){return RW(kT,e??(()=>!0),t)}function DF(e,t={}){return AW(kT,e,t)}function UF(e){const t=LF(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(hc(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(hc(o))}},e(n.value,n)));return t}function xT(e,t){return Sy(bT(e),t)}const Ty="2025-11-25",jF="2025-03-26",CT=[Ty,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],yi="io.modelcontextprotocol/related-task",bc="2.0",ln=MF(e=>e!==null&&(typeof e=="object"||typeof e=="function")),ky=pt([H(),nt().int()]),xy=H(),WF=Un({ttl:pt([nt(),yT()]).optional(),pollInterval:nt().optional()}),IT=le({ttl:nt().optional()}),PT=le({taskId:H()}),Cy=Un({progressToken:ky.optional(),[yi]:PT.optional()}),nr=le({_meta:Cy.optional()}),pa=nr.extend({task:IT.optional()}),RT=e=>pa.safeParse(e).success,Jt=le({method:H(),params:nr.loose().optional()}),_r=le({_meta:Cy.optional()}),rr=le({method:H(),params:_r.loose().optional()}),Xt=Un({_meta:Cy.optional()}),Ec=pt([H(),nt().int()]),Iy=le({jsonrpc:ye(bc),id:Ec,...Jt.shape}).strict(),Py=e=>Iy.safeParse(e).success,Ry=le({jsonrpc:ye(bc),...rr.shape}).strict(),AT=e=>Ry.safeParse(e).success,up=le({jsonrpc:ye(bc),id:Ec,result:Xt}).strict(),fa=e=>up.safeParse(e).success,FF=fa;var _e;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(_e||(_e={}));const Sc=le({jsonrpc:ye(bc),id:Ec.optional(),error:le({code:nt().int(),message:H(),data:xt().optional()})}).strict(),zF=Sc,Ay=e=>Sc.safeParse(e).success,BF=Ay,$y=pt([Iy,Ry,up,Sc]),GF=pt([up,Sc]),dp=Xt.strict(),$T=_r.extend({requestId:Ec.optional(),reason:H().optional()}),pp=rr.extend({method:ye("notifications/cancelled"),params:$T}),OT=le({src:H(),mimeType:H().optional(),sizes:Ge(H()).optional(),theme:tr(["light","dark"]).optional()}),ma=le({icons:Ge(OT).optional()}),ds=le({name:H(),title:H().optional()}),Oy=ds.extend({...ds.shape,...ma.shape,version:H(),websiteUrl:H().optional(),description:H().optional()}),HF=by(le({applyDefaults:an().optional()}),Ct(H(),xt())),qF=xT(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,by(le({form:HF.optional(),url:ln.optional()}),Ct(H(),xt()).optional())),NT=Un({list:ln.optional(),cancel:ln.optional(),requests:Un({sampling:Un({createMessage:ln.optional()}).optional(),elicitation:Un({create:ln.optional()}).optional()}).optional()}),LT=Un({list:ln.optional(),cancel:ln.optional(),requests:Un({tools:Un({call:ln.optional()}).optional()}).optional()}),MT=le({experimental:Ct(H(),ln).optional(),sampling:le({context:ln.optional(),tools:ln.optional()}).optional(),elicitation:qF.optional(),roots:le({listChanged:an().optional()}).optional(),tasks:NT.optional()}),DT=nr.extend({protocolVersion:H(),capabilities:MT,clientInfo:Oy}),fp=Jt.extend({method:ye("initialize"),params:DT}),VF=e=>fp.safeParse(e).success,UT=le({experimental:Ct(H(),ln).optional(),logging:ln.optional(),completions:ln.optional(),prompts:le({listChanged:an().optional()}).optional(),resources:le({subscribe:an().optional(),listChanged:an().optional()}).optional(),tools:le({listChanged:an().optional()}).optional(),tasks:LT.optional()}),jT=Xt.extend({protocolVersion:H(),capabilities:UT,serverInfo:Oy,instructions:H().optional()}),mp=rr.extend({method:ye("notifications/initialized"),params:_r.optional()}),KF=e=>mp.safeParse(e).success,hp=Jt.extend({method:ye("ping"),params:nr.optional()}),WT=le({progress:nt(),total:Nt(nt()),message:Nt(H())}),FT=le({..._r.shape,...WT.shape,progressToken:ky}),gp=rr.extend({method:ye("notifications/progress"),params:FT}),zT=nr.extend({cursor:xy.optional()}),ha=Jt.extend({params:zT.optional()}),ga=Xt.extend({nextCursor:xy.optional()}),BT=tr(["working","input_required","completed","failed","cancelled"]),ya=le({taskId:H(),status:BT,ttl:pt([nt(),yT()]),createdAt:H(),lastUpdatedAt:H(),pollInterval:Nt(nt()),statusMessage:Nt(H())}),Tc=Xt.extend({task:ya}),GT=_r.merge(ya),kc=rr.extend({method:ye("notifications/tasks/status"),params:GT}),yp=Jt.extend({method:ye("tasks/get"),params:nr.extend({taskId:H()})}),vp=Xt.merge(ya),_p=Jt.extend({method:ye("tasks/result"),params:nr.extend({taskId:H()})}),ZF=Xt.loose(),bp=ha.extend({method:ye("tasks/list")}),Ep=ga.extend({tasks:Ge(ya)}),Sp=Jt.extend({method:ye("tasks/cancel"),params:nr.extend({taskId:H()})}),HT=Xt.merge(ya),Ny=le({uri:H(),mimeType:Nt(H()),_meta:Ct(H(),xt()).optional()}),Ly=Ny.extend({text:H()}),My=H().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Dy=Ny.extend({blob:My}),wa=tr(["user","assistant"]),ps=le({audience:Ge(wa).optional(),priority:nt().min(0).max(1).optional(),lastModified:pT({offset:!0}).optional()}),Uy=le({...ds.shape,...ma.shape,uri:H(),description:Nt(H()),mimeType:Nt(H()),annotations:ps.optional(),_meta:Nt(Un({}))}),qT=le({...ds.shape,...ma.shape,uriTemplate:H(),description:Nt(H()),mimeType:Nt(H()),annotations:ps.optional(),_meta:Nt(Un({}))}),Tp=ha.extend({method:ye("resources/list")}),VT=ga.extend({resources:Ge(Uy)}),kp=ha.extend({method:ye("resources/templates/list")}),KT=ga.extend({resourceTemplates:Ge(qT)}),xp=nr.extend({uri:H()}),ZT=xp,Cp=Jt.extend({method:ye("resources/read"),params:ZT}),YT=Xt.extend({contents:Ge(pt([Ly,Dy]))}),JT=rr.extend({method:ye("notifications/resources/list_changed"),params:_r.optional()}),XT=xp,jy=Jt.extend({method:ye("resources/subscribe"),params:XT}),QT=xp,Wy=Jt.extend({method:ye("resources/unsubscribe"),params:QT}),ek=_r.extend({uri:H()}),tk=rr.extend({method:ye("notifications/resources/updated"),params:ek}),nk=le({name:H(),description:Nt(H()),required:Nt(an())}),rk=le({...ds.shape,...ma.shape,description:Nt(H()),arguments:Nt(Ge(nk)),_meta:Nt(Un({}))}),Ip=ha.extend({method:ye("prompts/list")}),ok=ga.extend({prompts:Ge(rk)}),ik=nr.extend({name:H(),arguments:Ct(H(),H()).optional()}),Pp=Jt.extend({method:ye("prompts/get"),params:ik}),Rp=le({type:ye("text"),text:H(),annotations:ps.optional(),_meta:Ct(H(),xt()).optional()}),Ap=le({type:ye("image"),data:My,mimeType:H(),annotations:ps.optional(),_meta:Ct(H(),xt()).optional()}),$p=le({type:ye("audio"),data:My,mimeType:H(),annotations:ps.optional(),_meta:Ct(H(),xt()).optional()}),sk=le({type:ye("tool_use"),name:H(),id:H(),input:Ct(H(),xt()),_meta:Ct(H(),xt()).optional()}),ak=le({type:ye("resource"),resource:pt([Ly,Dy]),annotations:ps.optional(),_meta:Ct(H(),xt()).optional()}),lk=Uy.extend({type:ye("resource_link")}),Op=pt([Rp,Ap,$p,lk,ak]),ck=le({role:wa,content:Op}),uk=Xt.extend({description:H().optional(),messages:Ge(ck)}),dk=rr.extend({method:ye("notifications/prompts/list_changed"),params:_r.optional()}),pk=le({title:H().optional(),readOnlyHint:an().optional(),destructiveHint:an().optional(),idempotentHint:an().optional(),openWorldHint:an().optional()}),fk=le({taskSupport:tr(["required","optional","forbidden"]).optional()}),Fy=le({...ds.shape,...ma.shape,description:H().optional(),inputSchema:le({type:ye("object"),properties:Ct(H(),ln).optional(),required:Ge(H()).optional()}).catchall(xt()),outputSchema:le({type:ye("object"),properties:Ct(H(),ln).optional(),required:Ge(H()).optional()}).catchall(xt()).optional(),annotations:pk.optional(),execution:fk.optional(),_meta:Ct(H(),xt()).optional()}),Np=ha.extend({method:ye("tools/list")}),mk=ga.extend({tools:Ge(Fy)}),Lp=Xt.extend({content:Ge(Op).default([]),structuredContent:Ct(H(),xt()).optional(),isError:an().optional()}),YF=Lp.or(Xt.extend({toolResult:xt()})),hk=pa.extend({name:H(),arguments:Ct(H(),xt()).optional()}),xc=Jt.extend({method:ye("tools/call"),params:hk}),gk=rr.extend({method:ye("notifications/tools/list_changed"),params:_r.optional()}),JF=le({autoRefresh:an().default(!0),debounceMs:nt().int().nonnegative().default(300)}),Cc=tr(["debug","info","notice","warning","error","critical","alert","emergency"]),yk=nr.extend({level:Cc}),zy=Jt.extend({method:ye("logging/setLevel"),params:yk}),wk=_r.extend({level:Cc,logger:H().optional(),data:xt()}),vk=rr.extend({method:ye("notifications/message"),params:wk}),_k=le({name:H().optional()}),bk=le({hints:Ge(_k).optional(),costPriority:nt().min(0).max(1).optional(),speedPriority:nt().min(0).max(1).optional(),intelligencePriority:nt().min(0).max(1).optional()}),Ek=le({mode:tr(["auto","required","none"]).optional()}),Sk=le({type:ye("tool_result"),toolUseId:H().describe("The unique identifier for the corresponding tool call."),content:Ge(Op).default([]),structuredContent:le({}).loose().optional(),isError:an().optional(),_meta:Ct(H(),xt()).optional()}),Tk=_T("type",[Rp,Ap,$p]),Ic=_T("type",[Rp,Ap,$p,sk,Sk]),Pc=le({role:wa,content:pt([Ic,Ge(Ic)]),_meta:Ct(H(),xt()).optional()}),kk=pa.extend({messages:Ge(Pc),modelPreferences:bk.optional(),systemPrompt:H().optional(),includeContext:tr(["none","thisServer","allServers"]).optional(),temperature:nt().optional(),maxTokens:nt().int(),stopSequences:Ge(H()).optional(),metadata:ln.optional(),tools:Ge(Fy).optional(),toolChoice:Ek.optional()}),xk=Jt.extend({method:ye("sampling/createMessage"),params:kk}),Mp=Xt.extend({model:H(),stopReason:Nt(tr(["endTurn","stopSequence","maxTokens"]).or(H())),role:wa,content:Tk}),By=Xt.extend({model:H(),stopReason:Nt(tr(["endTurn","stopSequence","maxTokens","toolUse"]).or(H())),role:wa,content:pt([Ic,Ge(Ic)])}),Ck=le({type:ye("boolean"),title:H().optional(),description:H().optional(),default:an().optional()}),Ik=le({type:ye("string"),title:H().optional(),description:H().optional(),minLength:nt().optional(),maxLength:nt().optional(),format:tr(["email","uri","date","date-time"]).optional(),default:H().optional()}),Pk=le({type:tr(["number","integer"]),title:H().optional(),description:H().optional(),minimum:nt().optional(),maximum:nt().optional(),default:nt().optional()}),Rk=le({type:ye("string"),title:H().optional(),description:H().optional(),enum:Ge(H()),default:H().optional()}),Ak=le({type:ye("string"),title:H().optional(),description:H().optional(),oneOf:Ge(le({const:H(),title:H()})),default:H().optional()}),$k=le({type:ye("string"),title:H().optional(),description:H().optional(),enum:Ge(H()),enumNames:Ge(H()).optional(),default:H().optional()}),Ok=pt([Rk,Ak]),Nk=le({type:ye("array"),title:H().optional(),description:H().optional(),minItems:nt().optional(),maxItems:nt().optional(),items:le({type:ye("string"),enum:Ge(H())}),default:Ge(H()).optional()}),Lk=le({type:ye("array"),title:H().optional(),description:H().optional(),minItems:nt().optional(),maxItems:nt().optional(),items:le({anyOf:Ge(le({const:H(),title:H()}))}),default:Ge(H()).optional()}),Mk=pt([Nk,Lk]),Dk=pt([$k,Ok,Mk]),Uk=pt([Dk,Ck,Ik,Pk]),jk=pa.extend({mode:ye("form").optional(),message:H(),requestedSchema:le({type:ye("object"),properties:Ct(H(),Uk),required:Ge(H()).optional()})}),Wk=pa.extend({mode:ye("url"),message:H(),elicitationId:H(),url:H().url()}),Fk=pt([jk,Wk]),zk=Jt.extend({method:ye("elicitation/create"),params:Fk}),Bk=_r.extend({elicitationId:H()}),Gk=rr.extend({method:ye("notifications/elicitation/complete"),params:Bk}),Rc=Xt.extend({action:tr(["accept","decline","cancel"]),content:xT(e=>e===null?void 0:e,Ct(H(),pt([H(),nt(),an(),Ge(H())])).optional())}),Gy=le({type:ye("ref/resource"),uri:H()}),XF=Gy,Hk=le({type:ye("ref/prompt"),name:H()}),qk=nr.extend({ref:pt([Hk,Gy]),argument:le({name:H(),value:H()}),context:le({arguments:Ct(H(),H()).optional()}).optional()}),Dp=Jt.extend({method:ye("completion/complete"),params:qk});function Vk(e){if(e.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function Kk(e){if(e.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}const Zk=Xt.extend({completion:Un({values:Ge(H()).max(100),total:Nt(nt().int()),hasMore:Nt(an())})}),Yk=le({uri:H().startsWith("file://"),name:H().optional(),_meta:Ct(H(),xt()).optional()}),Jk=Jt.extend({method:ye("roots/list"),params:nr.optional()}),Hy=Xt.extend({roots:Ge(Yk)}),Xk=rr.extend({method:ye("notifications/roots/list_changed"),params:_r.optional()}),QF=pt([hp,fp,Dp,zy,Pp,Ip,Tp,kp,Cp,jy,Wy,xc,Np,yp,_p,bp,Sp]),e4=pt([pp,gp,mp,Xk,kc]),t4=pt([dp,Mp,By,Rc,Hy,vp,Ep,Tc]),n4=pt([hp,xk,zk,Jk,yp,_p,bp,Sp]),r4=pt([pp,gp,vk,tk,JT,gk,dk,kc,Gk]),o4=pt([dp,jT,Zk,uk,ok,VT,KT,YT,Lp,mk,vp,Ep,Tc]);class he extends Error{constructor(t,n,r){super(`MCP error ${t}: ${n}`),this.code=t,this.data=r,this.name="McpError"}static fromError(t,n,r){if(t===_e.UrlElicitationRequired&&r){const o=r;if(o.elicitations)return new Qk(o.elicitations,n)}return new he(t,n,r)}}class Qk extends he{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super(_e.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){var t;return((t=this.data)==null?void 0:t.elicitations)??[]}}const ex=Object.freeze(Object.defineProperty({__proto__:null,AnnotationsSchema:ps,AudioContentSchema:$p,BaseMetadataSchema:ds,BlobResourceContentsSchema:Dy,BooleanSchemaSchema:Ck,CallToolRequestParamsSchema:hk,CallToolRequestSchema:xc,CallToolResultSchema:Lp,CancelTaskRequestSchema:Sp,CancelTaskResultSchema:HT,CancelledNotificationParamsSchema:$T,CancelledNotificationSchema:pp,ClientCapabilitiesSchema:MT,ClientNotificationSchema:e4,ClientRequestSchema:QF,ClientResultSchema:t4,ClientTasksCapabilitySchema:NT,CompatibilityCallToolResultSchema:YF,CompleteRequestParamsSchema:qk,CompleteRequestSchema:Dp,CompleteResultSchema:Zk,ContentBlockSchema:Op,CreateMessageRequestParamsSchema:kk,CreateMessageRequestSchema:xk,CreateMessageResultSchema:Mp,CreateMessageResultWithToolsSchema:By,CreateTaskResultSchema:Tc,CursorSchema:xy,DEFAULT_NEGOTIATED_PROTOCOL_VERSION:jF,ElicitRequestFormParamsSchema:jk,ElicitRequestParamsSchema:Fk,ElicitRequestSchema:zk,ElicitRequestURLParamsSchema:Wk,ElicitResultSchema:Rc,ElicitationCompleteNotificationParamsSchema:Bk,ElicitationCompleteNotificationSchema:Gk,EmbeddedResourceSchema:ak,EmptyResultSchema:dp,EnumSchemaSchema:Dk,get ErrorCode(){return _e},GetPromptRequestParamsSchema:ik,GetPromptRequestSchema:Pp,GetPromptResultSchema:uk,GetTaskPayloadRequestSchema:_p,GetTaskPayloadResultSchema:ZF,GetTaskRequestSchema:yp,GetTaskResultSchema:vp,IconSchema:OT,IconsSchema:ma,ImageContentSchema:Ap,ImplementationSchema:Oy,InitializeRequestParamsSchema:DT,InitializeRequestSchema:fp,InitializeResultSchema:jT,InitializedNotificationSchema:mp,JSONRPCErrorResponseSchema:Sc,JSONRPCErrorSchema:zF,JSONRPCMessageSchema:$y,JSONRPCNotificationSchema:Ry,JSONRPCRequestSchema:Iy,JSONRPCResponseSchema:GF,JSONRPCResultResponseSchema:up,JSONRPC_VERSION:bc,LATEST_PROTOCOL_VERSION:Ty,LegacyTitledEnumSchemaSchema:$k,ListChangedOptionsBaseSchema:JF,ListPromptsRequestSchema:Ip,ListPromptsResultSchema:ok,ListResourceTemplatesRequestSchema:kp,ListResourceTemplatesResultSchema:KT,ListResourcesRequestSchema:Tp,ListResourcesResultSchema:VT,ListRootsRequestSchema:Jk,ListRootsResultSchema:Hy,ListTasksRequestSchema:bp,ListTasksResultSchema:Ep,ListToolsRequestSchema:Np,ListToolsResultSchema:mk,LoggingLevelSchema:Cc,LoggingMessageNotificationParamsSchema:wk,LoggingMessageNotificationSchema:vk,McpError:he,ModelHintSchema:_k,ModelPreferencesSchema:bk,MultiSelectEnumSchemaSchema:Mk,NotificationSchema:rr,NumberSchemaSchema:Pk,PaginatedRequestParamsSchema:zT,PaginatedRequestSchema:ha,PaginatedResultSchema:ga,PingRequestSchema:hp,PrimitiveSchemaDefinitionSchema:Uk,ProgressNotificationParamsSchema:FT,ProgressNotificationSchema:gp,ProgressSchema:WT,ProgressTokenSchema:ky,PromptArgumentSchema:nk,PromptListChangedNotificationSchema:dk,PromptMessageSchema:ck,PromptReferenceSchema:Hk,PromptSchema:rk,RELATED_TASK_META_KEY:yi,ReadResourceRequestParamsSchema:ZT,ReadResourceRequestSchema:Cp,ReadResourceResultSchema:YT,RelatedTaskMetadataSchema:PT,RequestIdSchema:Ec,RequestSchema:Jt,ResourceContentsSchema:Ny,ResourceLinkSchema:lk,ResourceListChangedNotificationSchema:JT,ResourceReferenceSchema:XF,ResourceRequestParamsSchema:xp,ResourceSchema:Uy,ResourceTemplateReferenceSchema:Gy,ResourceTemplateSchema:qT,ResourceUpdatedNotificationParamsSchema:ek,ResourceUpdatedNotificationSchema:tk,ResultSchema:Xt,RoleSchema:wa,RootSchema:Yk,RootsListChangedNotificationSchema:Xk,SUPPORTED_PROTOCOL_VERSIONS:CT,SamplingContentSchema:Tk,SamplingMessageContentBlockSchema:Ic,SamplingMessageSchema:Pc,ServerCapabilitiesSchema:UT,ServerNotificationSchema:r4,ServerRequestSchema:n4,ServerResultSchema:o4,ServerTasksCapabilitySchema:LT,SetLevelRequestParamsSchema:yk,SetLevelRequestSchema:zy,SingleSelectEnumSchemaSchema:Ok,StringSchemaSchema:Ik,SubscribeRequestParamsSchema:XT,SubscribeRequestSchema:jy,TaskAugmentedRequestParamsSchema:pa,TaskCreationParamsSchema:WF,TaskMetadataSchema:IT,TaskSchema:ya,TaskStatusNotificationParamsSchema:GT,TaskStatusNotificationSchema:kc,TaskStatusSchema:BT,TextContentSchema:Rp,TextResourceContentsSchema:Ly,TitledMultiSelectEnumSchemaSchema:Lk,TitledSingleSelectEnumSchemaSchema:Ak,ToolAnnotationsSchema:pk,ToolChoiceSchema:Ek,ToolExecutionSchema:fk,ToolListChangedNotificationSchema:gk,ToolResultContentSchema:Sk,ToolSchema:Fy,ToolUseContentSchema:sk,UnsubscribeRequestParamsSchema:QT,UnsubscribeRequestSchema:Wy,UntitledMultiSelectEnumSchemaSchema:Nk,UntitledSingleSelectEnumSchemaSchema:Rk,UrlElicitationRequiredError:Qk,assertCompleteRequestPrompt:Vk,assertCompleteRequestResourceTemplate:Kk,isInitializeRequest:VF,isInitializedNotification:KF,isJSONRPCError:BF,isJSONRPCErrorResponse:Ay,isJSONRPCNotification:AT,isJSONRPCRequest:Py,isJSONRPCResponse:FF,isJSONRPCResultResponse:fa,isTaskAugmentedRequestParams:RT},Symbol.toStringTag,{value:"Module"}));function fs(e){return e==="completed"||e==="failed"||e==="cancelled"}const i4=Symbol("Let zodToJsonSchema decide on which parser to use"),tx={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},s4=e=>typeof e=="string"?{...tx,name:e}:{...tx,...e},a4=e=>{const t=s4(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}};function nx(e,t,n,r){r!=null&&r.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Qe(e,t,n,r,o){e[t]=n,nx(e,t,r,o)}const rx=(e,t)=>{let n=0;for(;nZe(e.innerType._def,t);function ix(e,t,n){const r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((o,i)=>ix(e,t,o))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return p4(e,t)}}const p4=(e,t)=>{const n={type:"integer",format:"unix-time"};if(t.target==="openApi3")return n;for(const r of e.checks)switch(r.kind){case"min":Qe(n,"minimum",r.value,r.message,t);break;case"max":Qe(n,"maximum",r.value,r.message,t);break}return n};function f4(e,t){return{...Ze(e.innerType._def,t),default:e.defaultValue()}}function m4(e,t){return t.effectStrategy==="input"?Ze(e.schema._def,t):jn(t)}function h4(e){return{type:"string",enum:Array.from(e.values)}}const g4=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function y4(e,t){const n=[Ze(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Ze(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i);let r=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const o=[];return n.forEach(i=>{if(g4(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(r=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){const{additionalProperties:a,...l}=i;s=l}else r=void 0;o.push(s)}}),o.length?{allOf:o,...r}:void 0}function w4(e,t){const n=typeof e.value;return n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:n==="bigint"?"integer":n,enum:[e.value]}:{type:n==="bigint"?"integer":n,const:e.value}}let qy;const qr={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(qy===void 0&&(qy=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),qy),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function sx(e,t){const n={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":Qe(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,t);break;case"max":Qe(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Vr(n,"email",r.message,t);break;case"format:idn-email":Vr(n,"idn-email",r.message,t);break;case"pattern:zod":xn(n,qr.email,r.message,t);break}break;case"url":Vr(n,"uri",r.message,t);break;case"uuid":Vr(n,"uuid",r.message,t);break;case"regex":xn(n,r.regex,r.message,t);break;case"cuid":xn(n,qr.cuid,r.message,t);break;case"cuid2":xn(n,qr.cuid2,r.message,t);break;case"startsWith":xn(n,RegExp(`^${Vy(r.value,t)}`),r.message,t);break;case"endsWith":xn(n,RegExp(`${Vy(r.value,t)}$`),r.message,t);break;case"datetime":Vr(n,"date-time",r.message,t);break;case"date":Vr(n,"date",r.message,t);break;case"time":Vr(n,"time",r.message,t);break;case"duration":Vr(n,"duration",r.message,t);break;case"length":Qe(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,t),Qe(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"includes":{xn(n,RegExp(Vy(r.value,t)),r.message,t);break}case"ip":{r.version!=="v6"&&Vr(n,"ipv4",r.message,t),r.version!=="v4"&&Vr(n,"ipv6",r.message,t);break}case"base64url":xn(n,qr.base64url,r.message,t);break;case"jwt":xn(n,qr.jwt,r.message,t);break;case"cidr":{r.version!=="v6"&&xn(n,qr.ipv4Cidr,r.message,t),r.version!=="v4"&&xn(n,qr.ipv6Cidr,r.message,t);break}case"emoji":xn(n,qr.emoji(),r.message,t);break;case"ulid":{xn(n,qr.ulid,r.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Vr(n,"binary",r.message,t);break}case"contentEncoding:base64":{Qe(n,"contentEncoding","base64",r.message,t);break}case"pattern:zod":{xn(n,qr.base64,r.message,t);break}}break}case"nanoid":xn(n,qr.nanoid,r.message,t)}return n}function Vy(e,t){return t.patternStrategy==="escape"?_4(e):e}const v4=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function _4(e){let t="";for(let n=0;ni.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):Qe(e,"format",t,n,r)}function xn(e,t,n,r){var o;e.pattern||(o=e.allOf)!=null&&o.some(i=>i.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:ax(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):Qe(e,"pattern",ax(t,r),n,r)}function ax(e,t){var l;if(!t.applyRegexFlags||!e.flags)return e.source;const n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},r=n.i?e.source.toLowerCase():e.source;let o="",i=!1,s=!1,a=!1;for(let c=0;c({...c,[u]:Ze(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",u]})??jn(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};const n={type:"object",additionalProperties:Ze(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return n;if(((o=e.keyType)==null?void 0:o._def.typeName)===ee.ZodString&&((i=e.keyType._def.checks)!=null&&i.length)){const{type:c,...u}=sx(e.keyType._def,t);return{...n,propertyNames:u}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===ee.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};if(((a=e.keyType)==null?void 0:a._def.typeName)===ee.ZodBranded&&e.keyType._def.type._def.typeName===ee.ZodString&&((l=e.keyType._def.type._def.checks)!=null&&l.length)){const{type:c,...u}=ox(e.keyType._def,t);return{...n,propertyNames:u}}}return n}function b4(e,t){if(t.mapStrategy==="record")return lx(e,t);const n=Ze(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||jn(t),r=Ze(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||jn(t);return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function E4(e){const t=e.values,r=Object.keys(e.values).filter(i=>typeof t[t[i]]!="number").map(i=>t[i]),o=Array.from(new Set(r.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r}}function S4(e){return e.target==="openAi"?void 0:{not:jn({...e,currentPath:[...e.currentPath,"not"]})}}function T4(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const Up={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function k4(e,t){if(t.target==="openApi3")return cx(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in Up&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((o,i)=>{const s=Up[i._def.typeName];return s&&!o.includes(s)?[...o,s]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((o,i)=>{const s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];case"bigint":return[...o,"integer"];case"object":if(i._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(r.length===n.length){const o=r.filter((i,s,a)=>a.indexOf(i)===s);return{type:o.length>1?o:o[0],enum:n.reduce((i,s)=>i.includes(s._def.value)?i:[...i,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter(i=>!r.includes(i))],[])};return cx(e,t)}const cx=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,o)=>Ze(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function x4(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:Up[e.innerType._def.typeName],nullable:!0}:{type:[Up[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){const r=Ze(e.innerType._def,{...t,currentPath:[...t.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}const n=Ze(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function C4(e,t){const n={type:"number"};if(!e.checks)return n;for(const r of e.checks)switch(r.kind){case"int":n.type="integer",nx(n,"type",r.message,t);break;case"min":t.target==="jsonSchema7"?r.inclusive?Qe(n,"minimum",r.value,r.message,t):Qe(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),Qe(n,"minimum",r.value,r.message,t));break;case"max":t.target==="jsonSchema7"?r.inclusive?Qe(n,"maximum",r.value,r.message,t):Qe(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),Qe(n,"maximum",r.value,r.message,t));break;case"multipleOf":Qe(n,"multipleOf",r.value,r.message,t);break}return n}function I4(e,t){const n=t.target==="openAi",r={type:"object",properties:{}},o=[],i=e.shape();for(const a in i){let l=i[a];if(l===void 0||l._def===void 0)continue;let c=R4(l);c&&n&&(l._def.typeName==="ZodOptional"&&(l=l._def.innerType),l.isNullable()||(l=l.nullable()),c=!1);const u=Ze(l._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});u!==void 0&&(r.properties[a]=u,c||o.push(a))}o.length&&(r.required=o);const s=P4(e,t);return s!==void 0&&(r.additionalProperties=s),r}function P4(e,t){if(e.catchall._def.typeName!=="ZodNever")return Ze(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function R4(e){try{return e.isOptional()}catch{return!0}}const A4=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return Ze(e.innerType._def,t);const n=Ze(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:jn(t)},n]}:jn(t)},$4=(e,t)=>{if(t.pipeStrategy==="input")return Ze(e.in._def,t);if(t.pipeStrategy==="output")return Ze(e.out._def,t);const n=Ze(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=Ze(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(o=>o!==void 0)}};function O4(e,t){return Ze(e.type._def,t)}function N4(e,t){const r={type:"array",uniqueItems:!0,items:Ze(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Qe(r,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Qe(r,"maxItems",e.maxSize.value,e.maxSize.message,t),r}function L4(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>Ze(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Ze(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>Ze(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function M4(e){return{not:jn(e)}}function D4(e){return jn(e)}const U4=(e,t)=>Ze(e.innerType._def,t),j4=(e,t,n)=>{switch(t){case ee.ZodString:return sx(e,n);case ee.ZodNumber:return C4(e,n);case ee.ZodObject:return I4(e,n);case ee.ZodBigInt:return c4(e,n);case ee.ZodBoolean:return u4();case ee.ZodDate:return ix(e,n);case ee.ZodUndefined:return M4(n);case ee.ZodNull:return T4(n);case ee.ZodArray:return l4(e,n);case ee.ZodUnion:case ee.ZodDiscriminatedUnion:return k4(e,n);case ee.ZodIntersection:return y4(e,n);case ee.ZodTuple:return L4(e,n);case ee.ZodRecord:return lx(e,n);case ee.ZodLiteral:return w4(e,n);case ee.ZodEnum:return h4(e);case ee.ZodNativeEnum:return E4(e);case ee.ZodNullable:return x4(e,n);case ee.ZodOptional:return A4(e,n);case ee.ZodMap:return b4(e,n);case ee.ZodSet:return N4(e,n);case ee.ZodLazy:return()=>e.getter()._def;case ee.ZodPromise:return O4(e,n);case ee.ZodNaN:case ee.ZodNever:return S4(n);case ee.ZodEffects:return m4(e,n);case ee.ZodAny:return jn(n);case ee.ZodUnknown:return D4(n);case ee.ZodDefault:return f4(e,n);case ee.ZodBranded:return ox(e,n);case ee.ZodReadonly:return U4(e,n);case ee.ZodCatch:return d4(e,n);case ee.ZodPipeline:return $4(e,n);case ee.ZodFunction:case ee.ZodVoid:case ee.ZodSymbol:return;default:return(r=>{})()}};function Ze(e,t,n=!1){var a;const r=t.seen.get(e);if(t.override){const l=(a=t.override)==null?void 0:a.call(t,e,t,r,n);if(l!==i4)return l}if(r&&!n){const l=W4(r,t);if(l!==void 0)return l}const o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);const i=j4(e,e.typeName,t),s=typeof i=="function"?Ze(i(),t):i;if(s&&F4(e,t,s),t.postProcess){const l=t.postProcess(s,e,t);return o.jsonSchema=s,l}return o.jsonSchema=s,s}const W4=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:rx(t.currentPath,e.path)};case"none":case"seen":return e.path.lengtht.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),jn(t)):t.$refStrategy==="seen"?jn(t):void 0}},F4=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),z4=(e,t)=>{const n=a4(t);let r=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((l,[c,u])=>({...l,[c]:Ze(u._def,{...n,currentPath:[...n.basePath,n.definitionPath,c]},!0)??jn(n)}),{}):void 0;const o=typeof t=="string"?t:(t==null?void 0:t.nameStrategy)==="title"||t==null?void 0:t.name,i=Ze(e._def,o===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,o]},!1)??jn(n),s=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;s!==void 0&&(i.title=s),n.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[n.openAiAnyTypeName]||(r[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:n.$refStrategy==="relative"?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));const a=o===void 0?r?{...i,[n.definitionPath]:r}:i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,o].join("/"),[n.definitionPath]:{...r,[o]:i}};return n.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(n.target==="jsonSchema2019-09"||n.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),n.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function B4(e){return!e||e==="jsonSchema7"||e==="draft-7"?"draft-7":e==="jsonSchema2019-09"||e==="draft-2020-12"?"draft-2020-12":"draft-7"}function ux(e,t){return uo(e)?$W(e,{target:B4(t==null?void 0:t.target),io:(t==null?void 0:t.pipeStrategy)??"input"}):z4(e,{strictUnions:(t==null?void 0:t.strictUnions)??!0,pipeStrategy:(t==null?void 0:t.pipeStrategy)??"input"})}function dx(e){const t=vc(e),n=t==null?void 0:t.method;if(!n)throw new Error("Schema is missing a method literal");const r=dT(n);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function px(e,t){const n=wc(e,t);if(!n.success)throw n.error;return n.data}const G4=6e4;class H4{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(pp,n=>{this._oncancel(n)}),this.setNotificationHandler(gp,n=>{this._onprogress(n)}),this.setRequestHandler(hp,n=>({})),this._taskStore=t==null?void 0:t.taskStore,this._taskMessageQueue=t==null?void 0:t.taskMessageQueue,this._taskStore&&(this.setRequestHandler(yp,async(n,r)=>{const o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new he(_e.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(_p,async(n,r)=>{const o=async()=>{var a;const i=n.params.taskId;if(this._taskMessageQueue){let l;for(;l=await this._taskMessageQueue.dequeue(i,r.sessionId);){if(l.type==="response"||l.type==="error"){const c=l.message,u=c.id,d=this._requestResolvers.get(u);if(d)if(this._requestResolvers.delete(u),l.type==="response")d(c);else{const p=c,m=new he(p.error.code,p.error.message,p.error.data);d(m)}else{const p=l.type==="response"?"Response":"Error";this._onerror(new Error(`${p} handler missing for request ${u}`))}continue}await((a=this._transport)==null?void 0:a.send(l.message,{relatedRequestId:r.requestId}))}}const s=await this._taskStore.getTask(i,r.sessionId);if(!s)throw new he(_e.InvalidParams,`Task not found: ${i}`);if(!fs(s.status))return await this._waitForTaskUpdate(i,r.signal),await o();if(fs(s.status)){const l=await this._taskStore.getTaskResult(i,r.sessionId);return this._clearTaskQueue(i),{...l,_meta:{...l._meta,[yi]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(bp,async(n,r)=>{var o;try{const{tasks:i,nextCursor:s}=await this._taskStore.listTasks((o=n.params)==null?void 0:o.cursor,r.sessionId);return{tasks:i,nextCursor:s,_meta:{}}}catch(i){throw new he(_e.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Sp,async(n,r)=>{try{const o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new he(_e.InvalidParams,`Task not found: ${n.params.taskId}`);if(fs(o.status))throw new he(_e.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(n.params.taskId);const i=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!i)throw new he(_e.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof he?o:new he(_e.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;const n=this._requestHandlerAbortControllers.get(t.params.requestId);n==null||n.abort(t.params.reason)}_setupTimeout(t,n,r,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){const n=this._timeoutInfo.get(t);if(!n)return!1;const r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),he.fromError(_e.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){const n=this._timeoutInfo.get(t);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(t))}async connect(t){var i,s,a;if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;const n=(i=this.transport)==null?void 0:i.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};const r=(s=this.transport)==null?void 0:s.onerror;this._transport.onerror=l=>{r==null||r(l),this._onerror(l)};const o=(a=this._transport)==null?void 0:a.onmessage;this._transport.onmessage=(l,c)=>{o==null||o(l,c),fa(l)||Ay(l)?this._onresponse(l):Py(l)?this._onrequest(l,c):AT(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var r;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();const n=he.fromError(_e.ConnectionClosed,"Connection closed");this._transport=void 0,(r=this.onclose)==null||r.call(this);for(const o of t.values())o(n)}_onerror(t){var n;(n=this.onerror)==null||n.call(this,t)}_onnotification(t){const n=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(t,n){var u,d,p,m;const r=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=(p=(d=(u=t.params)==null?void 0:u._meta)==null?void 0:d[yi])==null?void 0:p.taskId;if(r===void 0){const h={jsonrpc:"2.0",id:t.id,error:{code:_e.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:h,timestamp:Date.now()},o==null?void 0:o.sessionId).catch(w=>this._onerror(new Error(`Failed to enqueue error response: ${w}`))):o==null||o.send(h).catch(w=>this._onerror(new Error(`Failed to send an error response: ${w}`)));return}const s=new AbortController;this._requestHandlerAbortControllers.set(t.id,s);const a=RT(t.params)?t.params.task:void 0,l=this._taskStore?this.requestTaskStore(t,o==null?void 0:o.sessionId):void 0,c={signal:s.signal,sessionId:o==null?void 0:o.sessionId,_meta:(m=t.params)==null?void 0:m._meta,sendNotification:async h=>{if(s.signal.aborted)return;const w={relatedRequestId:t.id};i&&(w.relatedTask={taskId:i}),await this.notification(h,w)},sendRequest:async(h,w,v)=>{var y;if(s.signal.aborted)throw new he(_e.ConnectionClosed,"Request was cancelled");const f={...v,relatedRequestId:t.id};i&&!f.relatedTask&&(f.relatedTask={taskId:i});const g=((y=f.relatedTask)==null?void 0:y.taskId)??i;return g&&l&&await l.updateTaskStatus(g,"input_required"),await this.request(h,w,f)},authInfo:n==null?void 0:n.authInfo,requestId:t.id,requestInfo:n==null?void 0:n.requestInfo,taskId:i,taskStore:l,taskRequestedTtl:a==null?void 0:a.ttl,closeSSEStream:n==null?void 0:n.closeSSEStream,closeStandaloneSSEStream:n==null?void 0:n.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>r(t,c)).then(async h=>{if(s.signal.aborted)return;const w={result:h,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:w,timestamp:Date.now()},o==null?void 0:o.sessionId):await(o==null?void 0:o.send(w))},async h=>{if(s.signal.aborted)return;const w={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(h.code)?h.code:_e.InternalError,message:h.message??"Internal error",...h.data!==void 0&&{data:h.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:w,timestamp:Date.now()},o==null?void 0:o.sessionId):await(o==null?void 0:o.send(w))}).catch(h=>this._onerror(new Error(`Failed to send response: ${h}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:n,...r}=t.params,o=Number(n),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const s=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(l){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(l);return}i(r)}_onresponse(t){const n=Number(t.id),r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),fa(t))r(t);else{const s=new he(t.error.code,t.error.message,t.error.data);r(s)}return}const o=this._responseHandlers.get(n);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let i=!1;if(fa(t)&&t.result&&typeof t.result=="object"){const s=t.result;if(s.task&&typeof s.task=="object"){const a=s.task;typeof a.taskId=="string"&&(i=!0,this._taskProgressTokens.set(a.taskId,n))}}if(i||this._progressHandlers.delete(n),fa(t))o(t);else{const s=he.fromError(t.error.code,t.error.message,t.error.data);o(s)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)==null?void 0:t.close())}async*requestStream(t,n,r){var s,a;const{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(t,n,r)}}catch(l){yield{type:"error",error:l instanceof he?l:new he(_e.InternalError,String(l))}}return}let i;try{const l=await this.request(t,Tc,r);if(l.task)i=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new he(_e.InternalError,"Task creation did not return a task");for(;;){const c=await this.getTask({taskId:i},r);if(yield{type:"taskStatus",task:c},fs(c.status)){c.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},n,r)}:c.status==="failed"?yield{type:"error",error:new he(_e.InternalError,`Task ${i} failed`)}:c.status==="cancelled"&&(yield{type:"error",error:new he(_e.InternalError,`Task ${i} was cancelled`)});return}if(c.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},n,r)};return}const u=c.pollInterval??((s=this._options)==null?void 0:s.defaultTaskPollInterval)??1e3;await new Promise(d=>setTimeout(d,u)),(a=r==null?void 0:r.signal)==null||a.throwIfAborted()}}catch(l){yield{type:"error",error:l instanceof he?l:new he(_e.InternalError,String(l))}}}request(t,n,r){const{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:l}=r??{};return new Promise((c,u)=>{var g,y,_,E,S;const d=k=>{u(k)};if(!this._transport){d(new Error("Not connected"));return}if(((g=this._options)==null?void 0:g.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(k){d(k);return}(y=r==null?void 0:r.signal)==null||y.throwIfAborted();const p=this._requestMessageId++,m={...t,jsonrpc:"2.0",id:p};r!=null&&r.onprogress&&(this._progressHandlers.set(p,r.onprogress),m.params={...t.params,_meta:{...((_=t.params)==null?void 0:_._meta)||{},progressToken:p}}),a&&(m.params={...m.params,task:a}),l&&(m.params={...m.params,_meta:{...((E=m.params)==null?void 0:E._meta)||{},[yi]:l}});const h=k=>{var O;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(O=this._transport)==null||O.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(k)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(U=>this._onerror(new Error(`Failed to send cancellation: ${U}`)));const C=k instanceof he?k:new he(_e.RequestTimeout,String(k));u(C)};this._responseHandlers.set(p,k=>{var C;if(!((C=r==null?void 0:r.signal)!=null&&C.aborted)){if(k instanceof Error)return u(k);try{const O=wc(n,k.result);O.success?c(O.data):u(O.error)}catch(O){u(O)}}}),(S=r==null?void 0:r.signal)==null||S.addEventListener("abort",()=>{var k;h((k=r==null?void 0:r.signal)==null?void 0:k.reason)});const w=(r==null?void 0:r.timeout)??G4,v=()=>h(he.fromError(_e.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(p,w,r==null?void 0:r.maxTotalTimeout,v,(r==null?void 0:r.resetTimeoutOnProgress)??!1);const f=l==null?void 0:l.taskId;if(f){const k=C=>{const O=this._responseHandlers.get(p);O?O(C):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,k),this._enqueueTaskMessage(f,{type:"request",message:m,timestamp:Date.now()}).catch(C=>{this._cleanupTimeout(p),u(C)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(k=>{this._cleanupTimeout(p),u(k)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},vp,n)}async getTaskResult(t,n,r){return this.request({method:"tasks/result",params:t},n,r)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},Ep,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},HT,n)}async notification(t,n){var a,l,c,u;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const r=(a=n==null?void 0:n.relatedTask)==null?void 0:a.taskId;if(r){const d={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...((l=t.params)==null?void 0:l._meta)||{},[yi]:n.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:d,timestamp:Date.now()});return}if((((c=this._options)==null?void 0:c.debouncedNotificationMethods)??[]).includes(t.method)&&!t.params&&!(n!=null&&n.relatedRequestId)&&!(n!=null&&n.relatedTask)){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{var p,m;if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let d={...t,jsonrpc:"2.0"};n!=null&&n.relatedTask&&(d={...d,params:{...d.params,_meta:{...((p=d.params)==null?void 0:p._meta)||{},[yi]:n.relatedTask}}}),(m=this._transport)==null||m.send(d,n).catch(h=>this._onerror(h))});return}let s={...t,jsonrpc:"2.0"};n!=null&&n.relatedTask&&(s={...s,params:{...s.params,_meta:{...((u=s.params)==null?void 0:u._meta)||{},[yi]:n.relatedTask}}}),await this._transport.send(s,n)}setRequestHandler(t,n){const r=dx(t);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,i)=>{const s=px(t,o);return Promise.resolve(n(s,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,n){const r=dx(t);this._notificationHandlers.set(r,o=>{const i=px(t,o);return Promise.resolve(n(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,r){var i;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const o=(i=this._options)==null?void 0:i.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,r,o)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(t,n);for(const o of r)if(o.type==="request"&&Py(o.message)){const i=o.message.id,s=this._requestResolvers.get(i);s?(s(new he(_e.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n){var o,i;let r=((o=this._options)==null?void 0:o.defaultTaskPollInterval)??1e3;try{const s=await((i=this._taskStore)==null?void 0:i.getTask(t));s!=null&&s.pollInterval&&(r=s.pollInterval)}catch{}return new Promise((s,a)=>{if(n.aborted){a(new he(_e.InvalidRequest,"Request cancelled"));return}const l=setTimeout(s,r);n.addEventListener("abort",()=>{clearTimeout(l),a(new he(_e.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await r.createTask(o,t.id,{method:t.method,params:t.params},n)},getTask:async o=>{const i=await r.getTask(o,n);if(!i)throw new he(_e.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await r.storeTaskResult(o,i,s,n);const a=await r.getTask(o,n);if(a){const l=kc.parse({method:"notifications/tasks/status",params:a});await this.notification(l),fs(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>r.getTaskResult(o,n),updateTaskStatus:async(o,i,s)=>{const a=await r.getTask(o,n);if(!a)throw new he(_e.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(fs(a.status))throw new he(_e.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,i,s,n);const l=await r.getTask(o,n);if(l){const c=kc.parse({method:"notifications/tasks/status",params:l});await this.notification(c),fs(l.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>r.listTasks(o,n)}}}function fx(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function q4(e,t){const n={...e};for(const r in t){const o=r,i=t[o];if(i===void 0)continue;const s=n[o];fx(s)&&fx(i)?n[o]={...s,...i}:n[o]=i}return n}function Ac(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function wi(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var Ky={exports:{}},mx={},Kr={},va={},$c={},Ne={},Oc={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends t{constructor(g){if(super(),!e.IDENTIFIER.test(g))throw new Error("CodeGen: name must be a valid identifier");this.str=g}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class r extends t{constructor(g){super(),this._items=typeof g=="string"?[g]:g}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const g=this._items[0];return g===""||g==='""'}get str(){var g;return(g=this._str)!==null&&g!==void 0?g:this._str=this._items.reduce((y,_)=>`${y}${_}`,"")}get names(){var g;return(g=this._names)!==null&&g!==void 0?g:this._names=this._items.reduce((y,_)=>(_ instanceof n&&(y[_.str]=(y[_.str]||0)+1),y),{})}}e._Code=r,e.nil=new r("");function o(f,...g){const y=[f[0]];let _=0;for(;_{if(d.scopePath===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return(0,t._)`${c}${d.scopePath}`})}scopeCode(c=this._values,u,d){return this._reduceValues(c,p=>{if(p.value===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return p.value.code},u,d)}_reduceValues(c,u,d={},p){let m=t.nil;for(const h in c){const w=c[h];if(!w)continue;const v=d[h]=d[h]||new Map;w.forEach(f=>{if(v.has(f))return;v.set(f,r.Started);let g=u(f);if(g){const y=this.opts.es5?e.varKinds.var:e.varKinds.const;m=(0,t._)`${m}${y} ${f} = ${g};${this.opts._n}`}else if(g=p==null?void 0:p(f))m=(0,t._)`${m}${g}${this.opts._n}`;else throw new n(f);v.set(f,r.Completed)})}return m}}e.ValueScope=a})(Zy),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=Oc,n=Zy;var r=Oc;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var o=Zy;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class i{optimizeNodes(){return this}optimizeNames(x,I){return this}}class s extends i{constructor(x,I,F){super(),this.varKind=x,this.name=I,this.rhs=F}render({es5:x,_n:I}){const F=x?n.varKinds.var:this.varKind,ne=this.rhs===void 0?"":` = ${this.rhs}`;return`${F} ${this.name}${ne};`+I}optimizeNames(x,I){if(x[this.name.str])return this.rhs&&(this.rhs=j(this.rhs,x,I)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class a extends i{constructor(x,I,F){super(),this.lhs=x,this.rhs=I,this.sideEffects=F}render({_n:x}){return`${this.lhs} = ${this.rhs};`+x}optimizeNames(x,I){if(!(this.lhs instanceof t.Name&&!x[this.lhs.str]&&!this.sideEffects))return this.rhs=j(this.rhs,x,I),this}get names(){const x=this.lhs instanceof t.Name?{}:{...this.lhs.names};return L(x,this.rhs)}}class l extends a{constructor(x,I,F,ne){super(x,F,ne),this.op=I}render({_n:x}){return`${this.lhs} ${this.op}= ${this.rhs};`+x}}class c extends i{constructor(x){super(),this.label=x,this.names={}}render({_n:x}){return`${this.label}:`+x}}class u extends i{constructor(x){super(),this.label=x,this.names={}}render({_n:x}){return`break${this.label?` ${this.label}`:""};`+x}}class d extends i{constructor(x){super(),this.error=x}render({_n:x}){return`throw ${this.error};`+x}get names(){return this.error.names}}class p extends i{constructor(x){super(),this.code=x}render({_n:x}){return`${this.code};`+x}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(x,I){return this.code=j(this.code,x,I),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class m extends i{constructor(x=[]){super(),this.nodes=x}render(x){return this.nodes.reduce((I,F)=>I+F.render(x),"")}optimizeNodes(){const{nodes:x}=this;let I=x.length;for(;I--;){const F=x[I].optimizeNodes();Array.isArray(F)?x.splice(I,1,...F):F?x[I]=F:x.splice(I,1)}return x.length>0?this:void 0}optimizeNames(x,I){const{nodes:F}=this;let ne=F.length;for(;ne--;){const re=F[ne];re.optimizeNames(x,I)||(q(x,re.names),F.splice(ne,1))}return F.length>0?this:void 0}get names(){return this.nodes.reduce((x,I)=>A(x,I.names),{})}}class h extends m{render(x){return"{"+x._n+super.render(x)+"}"+x._n}}class w extends m{}class v extends h{}v.kind="else";class f extends h{constructor(x,I){super(I),this.condition=x}render(x){let I=`if(${this.condition})`+super.render(x);return this.else&&(I+="else "+this.else.render(x)),I}optimizeNodes(){super.optimizeNodes();const x=this.condition;if(x===!0)return this.nodes;let I=this.else;if(I){const F=I.optimizeNodes();I=this.else=Array.isArray(F)?new v(F):F}if(I)return x===!1?I instanceof f?I:I.nodes:this.nodes.length?this:new f(K(x),I instanceof f?[I]:I.nodes);if(!(x===!1||!this.nodes.length))return this}optimizeNames(x,I){var F;if(this.else=(F=this.else)===null||F===void 0?void 0:F.optimizeNames(x,I),!!(super.optimizeNames(x,I)||this.else))return this.condition=j(this.condition,x,I),this}get names(){const x=super.names;return L(x,this.condition),this.else&&A(x,this.else.names),x}}f.kind="if";class g extends h{}g.kind="for";class y extends g{constructor(x){super(),this.iteration=x}render(x){return`for(${this.iteration})`+super.render(x)}optimizeNames(x,I){if(super.optimizeNames(x,I))return this.iteration=j(this.iteration,x,I),this}get names(){return A(super.names,this.iteration.names)}}class _ extends g{constructor(x,I,F,ne){super(),this.varKind=x,this.name=I,this.from=F,this.to=ne}render(x){const I=x.es5?n.varKinds.var:this.varKind,{name:F,from:ne,to:re}=this;return`for(${I} ${F}=${ne}; ${F}<${re}; ${F}++)`+super.render(x)}get names(){const x=L(super.names,this.from);return L(x,this.to)}}class E extends g{constructor(x,I,F,ne){super(),this.loop=x,this.varKind=I,this.name=F,this.iterable=ne}render(x){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(x)}optimizeNames(x,I){if(super.optimizeNames(x,I))return this.iterable=j(this.iterable,x,I),this}get names(){return A(super.names,this.iterable.names)}}class S extends h{constructor(x,I,F){super(),this.name=x,this.args=I,this.async=F}render(x){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(x)}}S.kind="func";class k extends m{render(x){return"return "+super.render(x)}}k.kind="return";class C extends h{render(x){let I="try"+super.render(x);return this.catch&&(I+=this.catch.render(x)),this.finally&&(I+=this.finally.render(x)),I}optimizeNodes(){var x,I;return super.optimizeNodes(),(x=this.catch)===null||x===void 0||x.optimizeNodes(),(I=this.finally)===null||I===void 0||I.optimizeNodes(),this}optimizeNames(x,I){var F,ne;return super.optimizeNames(x,I),(F=this.catch)===null||F===void 0||F.optimizeNames(x,I),(ne=this.finally)===null||ne===void 0||ne.optimizeNames(x,I),this}get names(){const x=super.names;return this.catch&&A(x,this.catch.names),this.finally&&A(x,this.finally.names),x}}class O extends h{constructor(x){super(),this.error=x}render(x){return`catch(${this.error})`+super.render(x)}}O.kind="catch";class U extends h{render(x){return"finally"+super.render(x)}}U.kind="finally";class T{constructor(x,I={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...I,_n:I.lines?` `:""},this._extScope=x,this._scope=new n.Scope({parent:x}),this._nodes=[new w]}toString(){return this._root.render(this.opts)}name(x){return this._scope.name(x)}scopeName(x){return this._extScope.name(x)}scopeValue(x,I){const F=this._extScope.value(x,I);return(this._values[F.prefix]||(this._values[F.prefix]=new Set)).add(F),F}getScopeValue(x,I){return this._extScope.getValue(x,I)}scopeRefs(x){return this._extScope.scopeRefs(x,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(x,I,F,ne){const re=this._scope.toName(I);return F!==void 0&&ne&&(this._constants[re.str]=F),this._leafNode(new s(x,re,F)),re}const(x,I,F){return this._def(n.varKinds.const,x,I,F)}let(x,I,F){return this._def(n.varKinds.let,x,I,F)}var(x,I,F){return this._def(n.varKinds.var,x,I,F)}assign(x,I,F){return this._leafNode(new a(x,I,F))}add(x,I){return this._leafNode(new l(x,e.operators.ADD,I))}code(x){return typeof x=="function"?x():x!==t.nil&&this._leafNode(new p(x)),this}object(...x){const I=["{"];for(const[F,ne]of x)I.length>1&&I.push(","),I.push(F),(F!==ne||this.opts.es5)&&(I.push(":"),(0,t.addCodeArg)(I,ne));return I.push("}"),new t._Code(I)}if(x,I,F){if(this._blockNode(new f(x)),I&&F)this.code(I).else().code(F).endIf();else if(I)this.code(I).endIf();else if(F)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(x){return this._elseNode(new f(x))}else(){return this._elseNode(new v)}endIf(){return this._endBlockNode(f,v)}_for(x,I){return this._blockNode(x),I&&this.code(I).endFor(),this}for(x,I){return this._for(new y(x),I)}forRange(x,I,F,ne,re=this.opts.es5?n.varKinds.var:n.varKinds.let){const be=this._scope.toName(x);return this._for(new _(re,be,I,F),()=>ne(be))}forOf(x,I,F,ne=n.varKinds.const){const re=this._scope.toName(x);if(this.opts.es5){const be=I instanceof t.Name?I:this.var("_arr",I);return this.forRange("_i",0,(0,t._)`${be}.length`,$e=>{this.var(re,(0,t._)`${be}[${$e}]`),F(re)})}return this._for(new E("of",ne,re,I),()=>F(re))}forIn(x,I,F,ne=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(x,(0,t._)`Object.keys(${I})`,F);const re=this._scope.toName(x);return this._for(new E("in",ne,re,I),()=>F(re))}endFor(){return this._endBlockNode(g)}label(x){return this._leafNode(new c(x))}break(x){return this._leafNode(new u(x))}return(x){const I=new k;if(this._blockNode(I),this.code(x),I.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(x,I,F){if(!I&&!F)throw new Error('CodeGen: "try" without "catch" and "finally"');const ne=new C;if(this._blockNode(ne),this.code(x),I){const re=this.name("e");this._currNode=ne.catch=new O(re),I(re)}return F&&(this._currNode=ne.finally=new U,this.code(F)),this._endBlockNode(O,U)}throw(x){return this._leafNode(new d(x))}block(x,I){return this._blockStarts.push(this._nodes.length),x&&this.code(x).endBlock(I),this}endBlock(x){const I=this._blockStarts.pop();if(I===void 0)throw new Error("CodeGen: not in self-balancing block");const F=this._nodes.length-I;if(F<0||x!==void 0&&F!==x)throw new Error(`CodeGen: wrong number of nodes: ${F} vs ${x} expected`);return this._nodes.length=I,this}func(x,I=t.nil,F,ne){return this._blockNode(new S(x,I,F)),ne&&this.code(ne).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(x=1){for(;x-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(x){return this._currNode.nodes.push(x),this}_blockNode(x){this._currNode.nodes.push(x),this._nodes.push(x)}_endBlockNode(x,I){const F=this._currNode;if(F instanceof x||I&&F instanceof I)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${I?`${x.kind}/${I.kind}`:x.kind}"`)}_elseNode(x){const I=this._currNode;if(!(I instanceof f))throw new Error('CodeGen: "else" without "if"');return this._currNode=I.else=x,this}get _root(){return this._nodes[0]}get _currNode(){const x=this._nodes;return x[x.length-1]}set _currNode(x){const I=this._nodes;I[I.length-1]=x}}e.CodeGen=T;function A(D,x){for(const I in x)D[I]=(D[I]||0)+(x[I]||0);return D}function L(D,x){return x instanceof t._CodeOrName?A(D,x.names):D}function j(D,x,I){if(D instanceof t.Name)return F(D);if(!ne(D))return D;return new t._Code(D._items.reduce((re,be)=>(be instanceof t.Name&&(be=F(be)),be instanceof t._Code?re.push(...be._items):re.push(be),re),[]));function F(re){const be=I[re.str];return be===void 0||x[re.str]!==1?re:(delete x[re.str],be)}function ne(re){return re instanceof t._Code&&re._items.some(be=>be instanceof t.Name&&x[be.str]===1&&I[be.str]!==void 0)}}function q(D,x){for(const I in x)D[I]=(D[I]||0)-(x[I]||0)}function K(D){return typeof D=="boolean"||typeof D=="number"||D===null?!D:(0,t._)`!${G(D)}`}e.not=K;const J=$(e.operators.AND);function z(...D){return D.reduce(J)}e.and=z;const Z=$(e.operators.OR);function W(...D){return D.reduce(Z)}e.or=W;function $(D){return(x,I)=>x===t.nil?I:I===t.nil?x:(0,t._)`${G(x)} ${D} ${G(I)}`}function G(D){return D instanceof t.Name?D:(0,t._)`(${D})`}}(Ne);var se={};Object.defineProperty(se,"__esModule",{value:!0}),se.checkStrictMode=se.getErrorPath=se.Type=se.useFunc=se.setEvaluated=se.evaluatedPropsToName=se.mergeEvaluated=se.eachItem=se.unescapeJsonPointer=se.escapeJsonPointer=se.escapeFragment=se.unescapeFragment=se.schemaRefOrVal=se.schemaHasRulesButRef=se.schemaHasRules=se.checkUnknownRules=se.alwaysValidSchema=se.toHash=void 0;const st=Ne,V4=Oc;function K4(e){const t={};for(const n of e)t[n]=!0;return t}se.toHash=K4;function Z4(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(hx(e,t),!gx(t,e.self.RULES.all))}se.alwaysValidSchema=Z4;function hx(e,t=e.schema){const{opts:n,self:r}=e;if(!n.strictSchema||typeof t=="boolean")return;const o=r.RULES.keywords;for(const i in t)o[i]||bx(e,`unknown keyword: "${i}"`)}se.checkUnknownRules=hx;function gx(e,t){if(typeof e=="boolean")return!e;for(const n in e)if(t[n])return!0;return!1}se.schemaHasRules=gx;function Y4(e,t){if(typeof e=="boolean")return!e;for(const n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}se.schemaHasRulesButRef=Y4;function J4({topSchemaRef:e,schemaPath:t},n,r,o){if(!o){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return(0,st._)`${n}`}return(0,st._)`${e}${t}${(0,st.getProperty)(r)}`}se.schemaRefOrVal=J4;function X4(e){return yx(decodeURIComponent(e))}se.unescapeFragment=X4;function Q4(e){return encodeURIComponent(Yy(e))}se.escapeFragment=Q4;function Yy(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}se.escapeJsonPointer=Yy;function yx(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}se.unescapeJsonPointer=yx;function ez(e,t){if(Array.isArray(e))for(const n of e)t(n);else t(e)}se.eachItem=ez;function wx({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(o,i,s,a)=>{const l=s===void 0?i:s instanceof st.Name?(i instanceof st.Name?e(o,i,s):t(o,i,s),s):i instanceof st.Name?(t(o,s,i),i):n(i,s);return a===st.Name&&!(l instanceof st.Name)?r(o,l):l}}se.mergeEvaluated={props:wx({mergeNames:(e,t,n)=>e.if((0,st._)`${n} !== true && ${t} !== undefined`,()=>{e.if((0,st._)`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,(0,st._)`${n} || {}`).code((0,st._)`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if((0,st._)`${n} !== true`,()=>{t===!0?e.assign(n,!0):(e.assign(n,(0,st._)`${n} || {}`),Jy(e,n,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:vx}),items:wx({mergeNames:(e,t,n)=>e.if((0,st._)`${n} !== true && ${t} !== undefined`,()=>e.assign(n,(0,st._)`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if((0,st._)`${n} !== true`,()=>e.assign(n,t===!0?!0:(0,st._)`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function vx(e,t){if(t===!0)return e.var("props",!0);const n=e.var("props",(0,st._)`{}`);return t!==void 0&&Jy(e,n,t),n}se.evaluatedPropsToName=vx;function Jy(e,t,n){Object.keys(n).forEach(r=>e.assign((0,st._)`${t}${(0,st.getProperty)(r)}`,!0))}se.setEvaluated=Jy;const _x={};function tz(e,t){return e.scopeValue("func",{ref:t,code:_x[t.code]||(_x[t.code]=new V4._Code(t.code))})}se.useFunc=tz;var Xy;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Xy||(se.Type=Xy={}));function nz(e,t,n){if(e instanceof st.Name){const r=t===Xy.Num;return n?r?(0,st._)`"[" + ${e} + "]"`:(0,st._)`"['" + ${e} + "']"`:r?(0,st._)`"/" + ${e}`:(0,st._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,st.getProperty)(e).toString():"/"+Yy(e)}se.getErrorPath=nz;function bx(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw new Error(t);e.self.logger.warn(t)}}se.checkStrictMode=bx;var po={};Object.defineProperty(po,"__esModule",{value:!0});const yn=Ne,rz={data:new yn.Name("data"),valCxt:new yn.Name("valCxt"),instancePath:new yn.Name("instancePath"),parentData:new yn.Name("parentData"),parentDataProperty:new yn.Name("parentDataProperty"),rootData:new yn.Name("rootData"),dynamicAnchors:new yn.Name("dynamicAnchors"),vErrors:new yn.Name("vErrors"),errors:new yn.Name("errors"),this:new yn.Name("this"),self:new yn.Name("self"),scope:new yn.Name("scope"),json:new yn.Name("json"),jsonPos:new yn.Name("jsonPos"),jsonLen:new yn.Name("jsonLen"),jsonPart:new yn.Name("jsonPart")};po.default=rz,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=Ne,n=se,r=po;e.keywordError={message:({keyword:v})=>(0,t.str)`must pass "${v}" keyword validation`},e.keyword$DataError={message:({keyword:v,schemaType:f})=>f?(0,t.str)`"${v}" keyword must be ${f} ($data)`:(0,t.str)`"${v}" keyword is invalid ($data)`};function o(v,f=e.keywordError,g,y){const{it:_}=v,{gen:E,compositeRule:S,allErrors:k}=_,C=d(v,f,g);y??(S||k)?l(E,C):c(_,(0,t._)`[${C}]`)}e.reportError=o;function i(v,f=e.keywordError,g){const{it:y}=v,{gen:_,compositeRule:E,allErrors:S}=y,k=d(v,f,g);l(_,k),E||S||c(y,r.default.vErrors)}e.reportExtraError=i;function s(v,f){v.assign(r.default.errors,f),v.if((0,t._)`${r.default.vErrors} !== null`,()=>v.if(f,()=>v.assign((0,t._)`${r.default.vErrors}.length`,f),()=>v.assign(r.default.vErrors,null)))}e.resetErrorsCount=s;function a({gen:v,keyword:f,schemaValue:g,data:y,errsCount:_,it:E}){if(_===void 0)throw new Error("ajv implementation error");const S=v.name("err");v.forRange("i",_,r.default.errors,k=>{v.const(S,(0,t._)`${r.default.vErrors}[${k}]`),v.if((0,t._)`${S}.instancePath === undefined`,()=>v.assign((0,t._)`${S}.instancePath`,(0,t.strConcat)(r.default.instancePath,E.errorPath))),v.assign((0,t._)`${S}.schemaPath`,(0,t.str)`${E.errSchemaPath}/${f}`),E.opts.verbose&&(v.assign((0,t._)`${S}.schema`,g),v.assign((0,t._)`${S}.data`,y))})}e.extendErrors=a;function l(v,f){const g=v.const("err",f);v.if((0,t._)`${r.default.vErrors} === null`,()=>v.assign(r.default.vErrors,(0,t._)`[${g}]`),(0,t._)`${r.default.vErrors}.push(${g})`),v.code((0,t._)`${r.default.errors}++`)}function c(v,f){const{gen:g,validateName:y,schemaEnv:_}=v;_.$async?g.throw((0,t._)`new ${v.ValidationError}(${f})`):(g.assign((0,t._)`${y}.errors`,f),g.return(!1))}const u={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function d(v,f,g){const{createErrors:y}=v.it;return y===!1?(0,t._)`{}`:p(v,f,g)}function p(v,f,g={}){const{gen:y,it:_}=v,E=[m(_,g),h(v,g)];return w(v,f,E),y.object(...E)}function m({errorPath:v},{instancePath:f}){const g=f?(0,t.str)`${v}${(0,n.getErrorPath)(f,n.Type.Str)}`:v;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,g)]}function h({keyword:v,it:{errSchemaPath:f}},{schemaPath:g,parentSchema:y}){let _=y?f:(0,t.str)`${f}/${v}`;return g&&(_=(0,t.str)`${_}${(0,n.getErrorPath)(g,n.Type.Str)}`),[u.schemaPath,_]}function w(v,{params:f,message:g},y){const{keyword:_,data:E,schemaValue:S,it:k}=v,{opts:C,propertyName:O,topSchemaRef:U,schemaPath:T}=k;y.push([u.keyword,_],[u.params,typeof f=="function"?f(v):f||(0,t._)`{}`]),C.messages&&y.push([u.message,typeof g=="function"?g(v):g]),C.verbose&&y.push([u.schema,S],[u.parentSchema,(0,t._)`${U}${T}`],[r.default.data,E]),O&&y.push([u.propertyName,O])}}($c),Object.defineProperty(va,"__esModule",{value:!0}),va.boolOrEmptySchema=va.topBoolOrEmptySchema=void 0;const oz=$c,iz=Ne,sz=po,az={message:"boolean schema is false"};function lz(e){const{gen:t,schema:n,validateName:r}=e;n===!1?Ex(e,!1):typeof n=="object"&&n.$async===!0?t.return(sz.default.data):(t.assign((0,iz._)`${r}.errors`,null),t.return(!0))}va.topBoolOrEmptySchema=lz;function cz(e,t){const{gen:n,schema:r}=e;r===!1?(n.var(t,!1),Ex(e)):n.var(t,!0)}va.boolOrEmptySchema=cz;function Ex(e,t){const{gen:n,data:r}=e,o={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,oz.reportError)(o,az,void 0,t)}var qt={},ms={};Object.defineProperty(ms,"__esModule",{value:!0}),ms.getRules=ms.isJSONType=void 0;const uz=["string","number","integer","boolean","null","object","array"],dz=new Set(uz);function pz(e){return typeof e=="string"&&dz.has(e)}ms.isJSONType=pz;function fz(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}ms.getRules=fz;var Wo={};Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.shouldUseRule=Wo.shouldUseGroup=Wo.schemaHasRulesForType=void 0;function mz({schema:e,self:t},n){const r=t.RULES.types[n];return r&&r!==!0&&Sx(e,r)}Wo.schemaHasRulesForType=mz;function Sx(e,t){return t.rules.some(n=>Tx(e,n))}Wo.shouldUseGroup=Sx;function Tx(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some(r=>e[r]!==void 0))}Wo.shouldUseRule=Tx,Object.defineProperty(qt,"__esModule",{value:!0}),qt.reportTypeError=qt.checkDataTypes=qt.checkDataType=qt.coerceAndCheckDataType=qt.getJSONTypes=qt.getSchemaTypes=qt.DataType=void 0;const hz=ms,gz=Wo,yz=$c,Re=Ne,kx=se;var _a;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(_a||(qt.DataType=_a={}));function wz(e){const t=xx(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}qt.getSchemaTypes=wz;function xx(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(hz.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}qt.getJSONTypes=xx;function vz(e,t){const{gen:n,data:r,opts:o}=e,i=_z(t,o.coerceTypes),s=t.length>0&&!(i.length===0&&t.length===1&&(0,gz.schemaHasRulesForType)(e,t[0]));if(s){const a=ew(t,r,o.strictNumbers,_a.Wrong);n.if(a,()=>{i.length?bz(e,t,i):tw(e)})}return s}qt.coerceAndCheckDataType=vz;const Cx=new Set(["string","number","integer","boolean","null"]);function _z(e,t){return t?e.filter(n=>Cx.has(n)||t==="array"&&n==="array"):[]}function bz(e,t,n){const{gen:r,data:o,opts:i}=e,s=r.let("dataType",(0,Re._)`typeof ${o}`),a=r.let("coerced",(0,Re._)`undefined`);i.coerceTypes==="array"&&r.if((0,Re._)`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>r.assign(o,(0,Re._)`${o}[0]`).assign(s,(0,Re._)`typeof ${o}`).if(ew(t,o,i.strictNumbers),()=>r.assign(a,o))),r.if((0,Re._)`${a} !== undefined`);for(const c of n)(Cx.has(c)||c==="array"&&i.coerceTypes==="array")&&l(c);r.else(),tw(e),r.endIf(),r.if((0,Re._)`${a} !== undefined`,()=>{r.assign(o,a),Ez(e,a)});function l(c){switch(c){case"string":r.elseIf((0,Re._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,Re._)`"" + ${o}`).elseIf((0,Re._)`${o} === null`).assign(a,(0,Re._)`""`);return;case"number":r.elseIf((0,Re._)`${s} == "boolean" || ${o} === null || (${s} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,Re._)`+${o}`);return;case"integer":r.elseIf((0,Re._)`${s} === "boolean" || ${o} === null || (${s} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,Re._)`+${o}`);return;case"boolean":r.elseIf((0,Re._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,Re._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":r.elseIf((0,Re._)`${o} === "" || ${o} === 0 || ${o} === false`),r.assign(a,null);return;case"array":r.elseIf((0,Re._)`${s} === "string" || ${s} === "number" || ${s} === "boolean" || ${o} === null`).assign(a,(0,Re._)`[${o}]`)}}}function Ez({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,Re._)`${t} !== undefined`,()=>e.assign((0,Re._)`${t}[${n}]`,r))}function Qy(e,t,n,r=_a.Correct){const o=r===_a.Correct?Re.operators.EQ:Re.operators.NEQ;let i;switch(e){case"null":return(0,Re._)`${t} ${o} null`;case"array":i=(0,Re._)`Array.isArray(${t})`;break;case"object":i=(0,Re._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=s((0,Re._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=s();break;default:return(0,Re._)`typeof ${t} ${o} ${e}`}return r===_a.Correct?i:(0,Re.not)(i);function s(a=Re.nil){return(0,Re.and)((0,Re._)`typeof ${t} == "number"`,a,n?(0,Re._)`isFinite(${t})`:Re.nil)}}qt.checkDataType=Qy;function ew(e,t,n,r){if(e.length===1)return Qy(e[0],t,n,r);let o;const i=(0,kx.toHash)(e);if(i.array&&i.object){const s=(0,Re._)`typeof ${t} != "object"`;o=i.null?s:(0,Re._)`!${t} || ${s}`,delete i.null,delete i.array,delete i.object}else o=Re.nil;i.number&&delete i.integer;for(const s in i)o=(0,Re.and)(o,Qy(s,t,n,r));return o}qt.checkDataTypes=ew;const Sz={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,Re._)`{type: ${e}}`:(0,Re._)`{type: ${t}}`};function tw(e){const t=Tz(e);(0,yz.reportError)(t,Sz)}qt.reportTypeError=tw;function Tz(e){const{gen:t,data:n,schema:r}=e,o=(0,kx.schemaRefOrVal)(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:o,schemaValue:o,parentSchema:r,params:{},it:e}}var jp={};Object.defineProperty(jp,"__esModule",{value:!0}),jp.assignDefaults=void 0;const ba=Ne,kz=se;function xz(e,t){const{properties:n,items:r}=e.schema;if(t==="object"&&n)for(const o in n)Ix(e,o,n[o].default);else t==="array"&&Array.isArray(r)&&r.forEach((o,i)=>Ix(e,i,o.default))}jp.assignDefaults=xz;function Ix(e,t,n){const{gen:r,compositeRule:o,data:i,opts:s}=e;if(n===void 0)return;const a=(0,ba._)`${i}${(0,ba.getProperty)(t)}`;if(o){(0,kz.checkStrictMode)(e,`default is ignored for: ${a}`);return}let l=(0,ba._)`${a} === undefined`;s.useDefaults==="empty"&&(l=(0,ba._)`${l} || ${a} === null || ${a} === ""`),r.if(l,(0,ba._)`${a} = ${(0,ba.stringify)(n)}`)}var fo={},De={};Object.defineProperty(De,"__esModule",{value:!0}),De.validateUnion=De.validateArray=De.usePattern=De.callValidateCode=De.schemaProperties=De.allSchemaProperties=De.noPropertyInData=De.propertyInData=De.isOwnProperty=De.hasPropFunc=De.reportMissingProp=De.checkMissingProp=De.checkReportMissingProp=void 0;const ft=Ne,nw=se,vi=po,Cz=se;function Iz(e,t){const{gen:n,data:r,it:o}=e;n.if(ow(n,r,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ft._)`${t}`},!0),e.error()})}De.checkReportMissingProp=Iz;function Pz({gen:e,data:t,it:{opts:n}},r,o){return(0,ft.or)(...r.map(i=>(0,ft.and)(ow(e,t,i,n.ownProperties),(0,ft._)`${o} = ${i}`)))}De.checkMissingProp=Pz;function Rz(e,t){e.setParams({missingProperty:t},!0),e.error()}De.reportMissingProp=Rz;function Px(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ft._)`Object.prototype.hasOwnProperty`})}De.hasPropFunc=Px;function rw(e,t,n){return(0,ft._)`${Px(e)}.call(${t}, ${n})`}De.isOwnProperty=rw;function Az(e,t,n,r){const o=(0,ft._)`${t}${(0,ft.getProperty)(n)} !== undefined`;return r?(0,ft._)`${o} && ${rw(e,t,n)}`:o}De.propertyInData=Az;function ow(e,t,n,r){const o=(0,ft._)`${t}${(0,ft.getProperty)(n)} === undefined`;return r?(0,ft.or)(o,(0,ft.not)(rw(e,t,n))):o}De.noPropertyInData=ow;function Rx(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}De.allSchemaProperties=Rx;function $z(e,t){return Rx(t).filter(n=>!(0,nw.alwaysValidSchema)(e,t[n]))}De.schemaProperties=$z;function Oz({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:o,errorPath:i},it:s},a,l,c){const u=c?(0,ft._)`${e}, ${t}, ${r}${o}`:t,d=[[vi.default.instancePath,(0,ft.strConcat)(vi.default.instancePath,i)],[vi.default.parentData,s.parentData],[vi.default.parentDataProperty,s.parentDataProperty],[vi.default.rootData,vi.default.rootData]];s.opts.dynamicRef&&d.push([vi.default.dynamicAnchors,vi.default.dynamicAnchors]);const p=(0,ft._)`${u}, ${n.object(...d)}`;return l!==ft.nil?(0,ft._)`${a}.call(${l}, ${p})`:(0,ft._)`${a}(${p})`}De.callValidateCode=Oz;const Nz=(0,ft._)`new RegExp`;function Lz({gen:e,it:{opts:t}},n){const r=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(n,r);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ft._)`${o.code==="new RegExp"?Nz:(0,Cz.useFunc)(e,o)}(${n}, ${r})`})}De.usePattern=Lz;function Mz(e){const{gen:t,data:n,keyword:r,it:o}=e,i=t.name("valid");if(o.allErrors){const a=t.let("valid",!0);return s(()=>t.assign(a,!1)),a}return t.var(i,!0),s(()=>t.break()),i;function s(a){const l=t.const("len",(0,ft._)`${n}.length`);t.forRange("i",0,l,c=>{e.subschema({keyword:r,dataProp:c,dataPropType:nw.Type.Num},i),t.if((0,ft.not)(i),a)})}}De.validateArray=Mz;function Dz(e){const{gen:t,schema:n,keyword:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(l=>(0,nw.alwaysValidSchema)(o,l))&&!o.opts.unevaluated)return;const s=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((l,c)=>{const u=e.subschema({keyword:r,schemaProp:c,compositeRule:!0},a);t.assign(s,(0,ft._)`${s} || ${a}`),e.mergeValidEvaluated(u,a)||t.if((0,ft.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}De.validateUnion=Dz,Object.defineProperty(fo,"__esModule",{value:!0}),fo.validateKeywordUsage=fo.validSchemaType=fo.funcKeywordCode=fo.macroKeywordCode=void 0;const Cn=Ne,hs=po,Uz=De,jz=$c;function Wz(e,t){const{gen:n,keyword:r,schema:o,parentSchema:i,it:s}=e,a=t.macro.call(s.self,o,i,s),l=$x(n,r,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);const c=n.name("valid");e.subschema({schema:a,schemaPath:Cn.nil,errSchemaPath:`${s.errSchemaPath}/${r}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}fo.macroKeywordCode=Wz;function Fz(e,t){var n;const{gen:r,keyword:o,schema:i,parentSchema:s,$data:a,it:l}=e;Bz(l,t);const c=!a&&t.compile?t.compile.call(l.self,i,s,l):t.validate,u=$x(r,o,c),d=r.let("valid");e.block$data(d,p),e.ok((n=t.valid)!==null&&n!==void 0?n:d);function p(){if(t.errors===!1)w(),t.modifying&&Ax(e),v(()=>e.error());else{const f=t.async?m():h();t.modifying&&Ax(e),v(()=>zz(e,f))}}function m(){const f=r.let("ruleErrs",null);return r.try(()=>w((0,Cn._)`await `),g=>r.assign(d,!1).if((0,Cn._)`${g} instanceof ${l.ValidationError}`,()=>r.assign(f,(0,Cn._)`${g}.errors`),()=>r.throw(g))),f}function h(){const f=(0,Cn._)`${u}.errors`;return r.assign(f,null),w(Cn.nil),f}function w(f=t.async?(0,Cn._)`await `:Cn.nil){const g=l.opts.passContext?hs.default.this:hs.default.self,y=!("compile"in t&&!a||t.schema===!1);r.assign(d,(0,Cn._)`${f}${(0,Uz.callValidateCode)(e,u,g,y)}`,t.modifying)}function v(f){var g;r.if((0,Cn.not)((g=t.valid)!==null&&g!==void 0?g:d),f)}}fo.funcKeywordCode=Fz;function Ax(e){const{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,(0,Cn._)`${r.parentData}[${r.parentDataProperty}]`))}function zz(e,t){const{gen:n}=e;n.if((0,Cn._)`Array.isArray(${t})`,()=>{n.assign(hs.default.vErrors,(0,Cn._)`${hs.default.vErrors} === null ? ${t} : ${hs.default.vErrors}.concat(${t})`).assign(hs.default.errors,(0,Cn._)`${hs.default.vErrors}.length`),(0,jz.extendErrors)(e)},()=>e.error())}function Bz({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function $x(e,t,n){if(n===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:(0,Cn.stringify)(n)})}function Gz(e,t,n=!1){return!t.length||t.some(r=>r==="array"?Array.isArray(e):r==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==r||n&&typeof e>"u")}fo.validSchemaType=Gz;function Hz({schema:e,opts:t,self:n,errSchemaPath:r},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");const s=o.dependencies;if(s!=null&&s.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){const l=`keyword "${i}" value is invalid at path "${r}": `+n.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(l);else throw new Error(l)}}fo.validateKeywordUsage=Hz;var _i={};Object.defineProperty(_i,"__esModule",{value:!0}),_i.extendSubschemaMode=_i.extendSubschemaData=_i.getSubschema=void 0;const mo=Ne,Ox=se;function qz(e,{keyword:t,schemaProp:n,schema:r,schemaPath:o,errSchemaPath:i,topSchemaRef:s}){if(t!==void 0&&r!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){const a=e.schema[t];return n===void 0?{schema:a,schemaPath:(0,mo._)`${e.schemaPath}${(0,mo.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:(0,mo._)`${e.schemaPath}${(0,mo.getProperty)(t)}${(0,mo.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Ox.escapeFragment)(n)}`}}if(r!==void 0){if(o===void 0||i===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:o,topSchemaRef:s,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}_i.getSubschema=qz;function Vz(e,t,{dataProp:n,dataPropType:r,data:o,dataTypes:i,propertyName:s}){if(o!==void 0&&n!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:a}=t;if(n!==void 0){const{errorPath:c,dataPathArr:u,opts:d}=t,p=a.let("data",(0,mo._)`${t.data}${(0,mo.getProperty)(n)}`,!0);l(p),e.errorPath=(0,mo.str)`${c}${(0,Ox.getErrorPath)(n,r,d.jsPropertySyntax)}`,e.parentDataProperty=(0,mo._)`${n}`,e.dataPathArr=[...u,e.parentDataProperty]}if(o!==void 0){const c=o instanceof mo.Name?o:a.let("data",o,!0);l(c),s!==void 0&&(e.propertyName=s)}i&&(e.dataTypes=i);function l(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}_i.extendSubschemaData=Vz;function Kz(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:o,allErrors:i}){r!==void 0&&(e.compositeRule=r),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=n}_i.extendSubschemaMode=Kz;var cn={},Nx=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(i=Object.keys(t),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var s=i[o];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n},Lx={exports:{}},bi=Lx.exports=function(e,t,n){typeof t=="function"&&(n=t,t={}),n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},o=n.post||function(){};Wp(t,r,o,e,"",e)};bi.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},bi.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},bi.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},bi.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Wp(e,t,n,r,o,i,s,a,l,c){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,o,i,s,a,l,c);for(var u in r){var d=r[u];if(Array.isArray(d)){if(u in bi.arrayKeywords)for(var p=0;pt+=Mx(r)),t===1/0))return 1/0}return t}function Dx(e,t="",n){n!==!1&&(t=Ea(t));const r=e.parse(t);return Ux(e,r)}cn.getFullPath=Dx;function Ux(e,t){return e.serialize(t).split("#")[0]+"#"}cn._getFullPath=Ux;const rB=/#\/?$/;function Ea(e){return e?e.replace(rB,""):""}cn.normalizeId=Ea;function oB(e,t,n){return n=Ea(n),e.resolve(t,n)}cn.resolveUrl=oB;const iB=/^[a-z_][-a-z0-9._]*$/i;function sB(e,t){if(typeof e=="boolean")return{};const{schemaId:n,uriResolver:r}=this.opts,o=Ea(e[n]||t),i={"":o},s=Dx(r,o,!1),a={},l=new Set;return Qz(e,{allKeys:!0},(d,p,m,h)=>{if(h===void 0)return;const w=s+p;let v=i[h];typeof d[n]=="string"&&(v=f.call(this,d[n])),g.call(this,d.$anchor),g.call(this,d.$dynamicAnchor),i[p]=v;function f(y){const _=this.opts.uriResolver.resolve;if(y=Ea(v?_(v,y):y),l.has(y))throw u(y);l.add(y);let E=this.refs[y];return typeof E=="string"&&(E=this.refs[E]),typeof E=="object"?c(d,E.schema,y):y!==Ea(w)&&(y[0]==="#"?(c(d,a[y],y),a[y]=d):this.refs[y]=w),y}function g(y){if(typeof y=="string"){if(!iB.test(y))throw new Error(`invalid anchor "${y}"`);f.call(this,`#${y}`)}}}),a;function c(d,p,m){if(p!==void 0&&!Xz(d,p))throw u(m)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}cn.getSchemaRefs=sB,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.getData=Kr.KeywordCxt=Kr.validateFunctionCode=void 0;const jx=va,Wx=qt,sw=Wo,Fp=qt,aB=jp,Nc=fo,aw=_i,ge=Ne,Te=po,lB=cn,Fo=se,Lc=$c;function cB(e){if(Gx(e)&&(Hx(e),Bx(e))){pB(e);return}Fx(e,()=>(0,jx.topBoolOrEmptySchema)(e))}Kr.validateFunctionCode=cB;function Fx({gen:e,validateName:t,schema:n,schemaEnv:r,opts:o},i){o.code.es5?e.func(t,(0,ge._)`${Te.default.data}, ${Te.default.valCxt}`,r.$async,()=>{e.code((0,ge._)`"use strict"; ${zx(n,o)}`),dB(e,o),e.code(i)}):e.func(t,(0,ge._)`${Te.default.data}, ${uB(o)}`,r.$async,()=>e.code(zx(n,o)).code(i))}function uB(e){return(0,ge._)`{${Te.default.instancePath}="", ${Te.default.parentData}, ${Te.default.parentDataProperty}, ${Te.default.rootData}=${Te.default.data}${e.dynamicRef?(0,ge._)`, ${Te.default.dynamicAnchors}={}`:ge.nil}}={}`}function dB(e,t){e.if(Te.default.valCxt,()=>{e.var(Te.default.instancePath,(0,ge._)`${Te.default.valCxt}.${Te.default.instancePath}`),e.var(Te.default.parentData,(0,ge._)`${Te.default.valCxt}.${Te.default.parentData}`),e.var(Te.default.parentDataProperty,(0,ge._)`${Te.default.valCxt}.${Te.default.parentDataProperty}`),e.var(Te.default.rootData,(0,ge._)`${Te.default.valCxt}.${Te.default.rootData}`),t.dynamicRef&&e.var(Te.default.dynamicAnchors,(0,ge._)`${Te.default.valCxt}.${Te.default.dynamicAnchors}`)},()=>{e.var(Te.default.instancePath,(0,ge._)`""`),e.var(Te.default.parentData,(0,ge._)`undefined`),e.var(Te.default.parentDataProperty,(0,ge._)`undefined`),e.var(Te.default.rootData,Te.default.data),t.dynamicRef&&e.var(Te.default.dynamicAnchors,(0,ge._)`{}`)})}function pB(e){const{schema:t,opts:n,gen:r}=e;Fx(e,()=>{n.$comment&&t.$comment&&Vx(e),yB(e),r.let(Te.default.vErrors,null),r.let(Te.default.errors,0),n.unevaluated&&fB(e),qx(e),_B(e)})}function fB(e){const{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",(0,ge._)`${n}.evaluated`),t.if((0,ge._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,ge._)`${e.evaluated}.props`,(0,ge._)`undefined`)),t.if((0,ge._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,ge._)`${e.evaluated}.items`,(0,ge._)`undefined`))}function zx(e,t){const n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,ge._)`/*# sourceURL=${n} */`:ge.nil}function mB(e,t){if(Gx(e)&&(Hx(e),Bx(e))){hB(e,t);return}(0,jx.boolOrEmptySchema)(e,t)}function Bx({schema:e,self:t}){if(typeof e=="boolean")return!e;for(const n in e)if(t.RULES.all[n])return!0;return!1}function Gx(e){return typeof e.schema!="boolean"}function hB(e,t){const{schema:n,gen:r,opts:o}=e;o.$comment&&n.$comment&&Vx(e),wB(e),vB(e);const i=r.const("_errs",Te.default.errors);qx(e,i),r.var(t,(0,ge._)`${i} === ${Te.default.errors}`)}function Hx(e){(0,Fo.checkUnknownRules)(e),gB(e)}function qx(e,t){if(e.opts.jtd)return Kx(e,[],!1,t);const n=(0,Wx.getSchemaTypes)(e.schema),r=(0,Wx.coerceAndCheckDataType)(e,n);Kx(e,n,!r,t)}function gB(e){const{schema:t,errSchemaPath:n,opts:r,self:o}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,Fo.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function yB(e){const{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,Fo.checkStrictMode)(e,"default is ignored in the schema root")}function wB(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,lB.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function vB(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Vx({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:o}){const i=n.$comment;if(o.$comment===!0)e.code((0,ge._)`${Te.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){const s=(0,ge.str)`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,ge._)`${Te.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function _B(e){const{gen:t,schemaEnv:n,validateName:r,ValidationError:o,opts:i}=e;n.$async?t.if((0,ge._)`${Te.default.errors} === 0`,()=>t.return(Te.default.data),()=>t.throw((0,ge._)`new ${o}(${Te.default.vErrors})`)):(t.assign((0,ge._)`${r}.errors`,Te.default.vErrors),i.unevaluated&&bB(e),t.return((0,ge._)`${Te.default.errors} === 0`))}function bB({gen:e,evaluated:t,props:n,items:r}){n instanceof ge.Name&&e.assign((0,ge._)`${t}.props`,n),r instanceof ge.Name&&e.assign((0,ge._)`${t}.items`,r)}function Kx(e,t,n,r){const{gen:o,schema:i,data:s,allErrors:a,opts:l,self:c}=e,{RULES:u}=c;if(i.$ref&&(l.ignoreKeywordsWithRef||!(0,Fo.schemaHasRulesButRef)(i,u))){o.block(()=>Xx(e,"$ref",u.all.$ref.definition));return}l.jtd||EB(e,t),o.block(()=>{for(const p of u.rules)d(p);d(u.post)});function d(p){(0,sw.shouldUseGroup)(i,p)&&(p.type?(o.if((0,Fp.checkDataType)(p.type,s,l.strictNumbers)),Zx(e,p),t.length===1&&t[0]===p.type&&n&&(o.else(),(0,Fp.reportTypeError)(e)),o.endIf()):Zx(e,p),a||o.if((0,ge._)`${Te.default.errors} === ${r||0}`))}}function Zx(e,t){const{gen:n,schema:r,opts:{useDefaults:o}}=e;o&&(0,aB.assignDefaults)(e,t.type),n.block(()=>{for(const i of t.rules)(0,sw.shouldUseRule)(r,i)&&Xx(e,i.keyword,i.definition,t.type)})}function EB(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(SB(e,t),e.opts.allowUnionTypes||TB(e,t),kB(e,e.dataTypes))}function SB(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(n=>{Yx(e.dataTypes,n)||lw(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),CB(e,t)}}function TB(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&lw(e,"use allowUnionTypes to allow union type keyword")}function kB(e,t){const n=e.self.RULES.all;for(const r in n){const o=n[r];if(typeof o=="object"&&(0,sw.shouldUseRule)(e.schema,o)){const{type:i}=o.definition;i.length&&!i.some(s=>xB(t,s))&&lw(e,`missing type "${i.join(",")}" for keyword "${r}"`)}}}function xB(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Yx(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function CB(e,t){const n=[];for(const r of e.dataTypes)Yx(t,r)?n.push(r):t.includes("integer")&&r==="number"&&n.push("integer");e.dataTypes=n}function lw(e,t){const n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,Fo.checkStrictMode)(e,t,e.opts.strictTypes)}class Jx{constructor(t,n,r){if((0,Nc.validateKeywordUsage)(t,n,r),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=r,this.data=t.data,this.schema=t.schema[r],this.$data=n.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Fo.schemaRefOrVal)(t,this.schema,r,this.$data),this.schemaType=n.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=n,this.$data)this.schemaCode=t.gen.const("vSchema",Qx(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Nc.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(n.schemaType)}`);("code"in n?n.trackErrors:n.errors!==!1)&&(this.errsCount=t.gen.const("_errs",Te.default.errors))}result(t,n,r){this.failResult((0,ge.not)(t),n,r)}failResult(t,n,r){this.gen.if(t),r?r():this.error(),n?(this.gen.else(),n(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,n){this.failResult((0,ge.not)(t),void 0,n)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:n}=this;this.fail((0,ge._)`${n} !== undefined && (${(0,ge.or)(this.invalid$data(),t)})`)}error(t,n,r){if(n){this.setParams(n),this._error(t,r),this.setParams({});return}this._error(t,r)}_error(t,n){(t?Lc.reportExtraError:Lc.reportError)(this,this.def.error,n)}$dataError(){(0,Lc.reportError)(this,this.def.$dataError||Lc.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Lc.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,n){n?Object.assign(this.params,t):this.params=t}block$data(t,n,r=ge.nil){this.gen.block(()=>{this.check$data(t,r),n()})}check$data(t=ge.nil,n=ge.nil){if(!this.$data)return;const{gen:r,schemaCode:o,schemaType:i,def:s}=this;r.if((0,ge.or)((0,ge._)`${o} === undefined`,n)),t!==ge.nil&&r.assign(t,!0),(i.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),t!==ge.nil&&r.assign(t,!1)),r.else()}invalid$data(){const{gen:t,schemaCode:n,schemaType:r,def:o,it:i}=this;return(0,ge.or)(s(),a());function s(){if(r.length){if(!(n instanceof ge.Name))throw new Error("ajv implementation error");const l=Array.isArray(r)?r:[r];return(0,ge._)`${(0,Fp.checkDataTypes)(l,n,i.opts.strictNumbers,Fp.DataType.Wrong)}`}return ge.nil}function a(){if(o.validateSchema){const l=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,ge._)`!${l}(${n})`}return ge.nil}}subschema(t,n){const r=(0,aw.getSubschema)(this.it,t);(0,aw.extendSubschemaData)(r,this.it,t),(0,aw.extendSubschemaMode)(r,t);const o={...this.it,...r,items:void 0,props:void 0};return mB(o,n),o}mergeEvaluated(t,n){const{it:r,gen:o}=this;r.opts.unevaluated&&(r.props!==!0&&t.props!==void 0&&(r.props=Fo.mergeEvaluated.props(o,t.props,r.props,n)),r.items!==!0&&t.items!==void 0&&(r.items=Fo.mergeEvaluated.items(o,t.items,r.items,n)))}mergeValidEvaluated(t,n){const{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(n,()=>this.mergeEvaluated(t,ge.Name)),!0}}Kr.KeywordCxt=Jx;function Xx(e,t,n,r){const o=new Jx(e,n,t);"code"in n?n.code(o,r):o.$data&&n.validate?(0,Nc.funcKeywordCode)(o,n):"macro"in n?(0,Nc.macroKeywordCode)(o,n):(n.compile||n.validate)&&(0,Nc.funcKeywordCode)(o,n)}const IB=/^\/(?:[^~]|~0|~1)*$/,PB=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Qx(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let o,i;if(e==="")return Te.default.rootData;if(e[0]==="/"){if(!IB.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=Te.default.rootData}else{const c=PB.exec(e);if(!c)throw new Error(`Invalid JSON-pointer: ${e}`);const u=+c[1];if(o=c[2],o==="#"){if(u>=t)throw new Error(l("property/index",u));return r[t-u]}if(u>t)throw new Error(l("data",u));if(i=n[t-u],!o)return i}let s=i;const a=o.split("/");for(const c of a)c&&(i=(0,ge._)`${i}${(0,ge.getProperty)((0,Fo.unescapeJsonPointer)(c))}`,s=(0,ge._)`${s} && ${i}`);return s;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}Kr.getData=Qx;var Mc={};Object.defineProperty(Mc,"__esModule",{value:!0});class RB extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}}Mc.default=RB;var Sa={};Object.defineProperty(Sa,"__esModule",{value:!0});const cw=cn;class AB extends Error{constructor(t,n,r,o){super(o||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,cw.resolveUrl)(t,n,r),this.missingSchema=(0,cw.normalizeId)((0,cw.getFullPath)(t,this.missingRef))}}Sa.default=AB;var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.resolveSchema=Wn.getCompilingSchema=Wn.resolveRef=Wn.compileSchema=Wn.SchemaEnv=void 0;const Zr=Ne,$B=Mc,gs=po,Yr=cn,eC=se,OB=Kr;class zp{constructor(t){var n;this.refs={},this.dynamicAnchors={};let r;typeof t.schema=="object"&&(r=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(n=t.baseId)!==null&&n!==void 0?n:(0,Yr.normalizeId)(r==null?void 0:r[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=r==null?void 0:r.$async,this.refs={}}}Wn.SchemaEnv=zp;function uw(e){const t=tC.call(this,e);if(t)return t;const n=(0,Yr.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:r,lines:o}=this.opts.code,{ownProperties:i}=this.opts,s=new Zr.CodeGen(this.scope,{es5:r,lines:o,ownProperties:i});let a;e.$async&&(a=s.scopeValue("Error",{ref:$B.default,code:(0,Zr._)`require("ajv/dist/runtime/validation_error").default`}));const l=s.scopeName("validate");e.validateName=l;const c={gen:s,allErrors:this.opts.allErrors,data:gs.default.data,parentData:gs.default.parentData,parentDataProperty:gs.default.parentDataProperty,dataNames:[gs.default.data],dataPathArr:[Zr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Zr.stringify)(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:Zr.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Zr._)`""`,opts:this.opts,self:this};let u;try{this._compilations.add(e),(0,OB.validateFunctionCode)(c),s.optimize(this.opts.code.optimize);const d=s.toString();u=`${s.scopeRefs(gs.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,e));const m=new Function(`${gs.default.self}`,`${gs.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:l,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){const{props:h,items:w}=c;m.evaluated={props:h instanceof Zr.Name?void 0:h,items:w instanceof Zr.Name?void 0:w,dynamicProps:h instanceof Zr.Name,dynamicItems:w instanceof Zr.Name},m.source&&(m.source.evaluated=(0,Zr.stringify)(m.evaluated))}return e.validate=m,e}catch(d){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(e)}}Wn.compileSchema=uw;function NB(e,t,n){var r;n=(0,Yr.resolveUrl)(this.opts.uriResolver,t,n);const o=e.refs[n];if(o)return o;let i=DB.call(this,e,n);if(i===void 0){const s=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;s&&(i=new zp({schema:s,schemaId:a,root:e,baseId:t}))}if(i!==void 0)return e.refs[n]=LB.call(this,i)}Wn.resolveRef=NB;function LB(e){return(0,Yr.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:uw.call(this,e)}function tC(e){for(const t of this._compilations)if(MB(t,e))return t}Wn.getCompilingSchema=tC;function MB(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function DB(e,t){let n;for(;typeof(n=this.refs[t])=="string";)t=n;return n||this.schemas[t]||Bp.call(this,e,t)}function Bp(e,t){const n=this.opts.uriResolver.parse(t),r=(0,Yr._getFullPath)(this.opts.uriResolver,n);let o=(0,Yr.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===o)return dw.call(this,n,e);const i=(0,Yr.normalizeId)(r),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){const a=Bp.call(this,e,s);return typeof(a==null?void 0:a.schema)!="object"?void 0:dw.call(this,n,a)}if(typeof(s==null?void 0:s.schema)=="object"){if(s.validate||uw.call(this,s),i===(0,Yr.normalizeId)(t)){const{schema:a}=s,{schemaId:l}=this.opts,c=a[l];return c&&(o=(0,Yr.resolveUrl)(this.opts.uriResolver,o,c)),new zp({schema:a,schemaId:l,root:e,baseId:o})}return dw.call(this,n,s)}}Wn.resolveSchema=Bp;const UB=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function dw(e,{baseId:t,schema:n,root:r}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(const a of e.fragment.slice(1).split("/")){if(typeof n=="boolean")return;const l=n[(0,eC.unescapeFragment)(a)];if(l===void 0)return;n=l;const c=typeof n=="object"&&n[this.opts.schemaId];!UB.has(a)&&c&&(t=(0,Yr.resolveUrl)(this.opts.uriResolver,t,c))}let i;if(typeof n!="boolean"&&n.$ref&&!(0,eC.schemaHasRulesButRef)(n,this.RULES)){const a=(0,Yr.resolveUrl)(this.opts.uriResolver,t,n.$ref);i=Bp.call(this,r,a)}const{schemaId:s}=this.opts;if(i=i||new zp({schema:n,schemaId:s,root:r,baseId:t}),i.schema!==i.root.schema)return i}const jB={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1};var pw={},Gp={exports:{}};const WB=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),nC=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function rC(e){let t="",n=0,r=0;for(r=0;r=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r];break}for(r+=1;r=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r]}return t}const FB=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function oC(e){return e.length=0,!0}function zB(e,t,n){if(e.length){const r=rC(e);if(r!=="")t.push(r);else return n.error=!0,!1;e.length=0}return!0}function BB(e){let t=0;const n={error:!1,address:"",zone:""},r=[],o=[];let i=!1,s=!1,a=zB;for(let l=0;l7){n.error=!0;break}l>0&&e[l-1]===":"&&(i=!0),r.push(":");continue}else if(c==="%"){if(!a(o,r,n))break;a=oC}else{o.push(c);continue}}return o.length&&(a===oC?n.zone=o.join(""):s?r.push(o.join("")):r.push(rC(o))),n.address=r.join(""),n}function iC(e){if(GB(e,":")<2)return{host:e,isIPV6:!1};const t=BB(e);if(t.error)return{host:e,isIPV6:!1};{let n=t.address,r=t.address;return t.zone&&(n+="%"+t.zone,r+="%25"+t.zone),{host:n,isIPV6:!0,escapedHost:r}}}function GB(e,t){let n=0;for(let r=0;rnew RegExp(W,$);m.code="new RegExp";const h=["removeAdditional","useDefaults","coerceTypes"],w=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),v={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},f={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},g=200;function y(W){var $,G,D,x,I,F,ne,re,be,$e,it,er,gn,yr,ta,os,is,na,ra,Mn,zr,ss,as,Br,Gr;const No=W.strict,di=($=W.code)===null||$===void 0?void 0:$.optimize,oa=di===!0||di===void 0?1:di||0,Pe=(D=(G=W.code)===null||G===void 0?void 0:G.regExp)!==null&&D!==void 0?D:m,qg=(x=W.uriResolver)!==null&&x!==void 0?x:p.default;return{strictSchema:(F=(I=W.strictSchema)!==null&&I!==void 0?I:No)!==null&&F!==void 0?F:!0,strictNumbers:(re=(ne=W.strictNumbers)!==null&&ne!==void 0?ne:No)!==null&&re!==void 0?re:!0,strictTypes:($e=(be=W.strictTypes)!==null&&be!==void 0?be:No)!==null&&$e!==void 0?$e:"log",strictTuples:(er=(it=W.strictTuples)!==null&&it!==void 0?it:No)!==null&&er!==void 0?er:"log",strictRequired:(yr=(gn=W.strictRequired)!==null&&gn!==void 0?gn:No)!==null&&yr!==void 0?yr:!1,code:W.code?{...W.code,optimize:oa,regExp:Pe}:{optimize:oa,regExp:Pe},loopRequired:(ta=W.loopRequired)!==null&&ta!==void 0?ta:g,loopEnum:(os=W.loopEnum)!==null&&os!==void 0?os:g,meta:(is=W.meta)!==null&&is!==void 0?is:!0,messages:(na=W.messages)!==null&&na!==void 0?na:!0,inlineRefs:(ra=W.inlineRefs)!==null&&ra!==void 0?ra:!0,schemaId:(Mn=W.schemaId)!==null&&Mn!==void 0?Mn:"$id",addUsedSchema:(zr=W.addUsedSchema)!==null&&zr!==void 0?zr:!0,validateSchema:(ss=W.validateSchema)!==null&&ss!==void 0?ss:!0,validateFormats:(as=W.validateFormats)!==null&&as!==void 0?as:!0,unicodeRegExp:(Br=W.unicodeRegExp)!==null&&Br!==void 0?Br:!0,int32range:(Gr=W.int32range)!==null&&Gr!==void 0?Gr:!0,uriResolver:qg}}class _{constructor($={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,$=this.opts={...$,...y($)};const{es5:G,lines:D}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:w,es5:G,lines:D}),this.logger=A($.logger);const x=$.validateFormats;$.validateFormats=!1,this.RULES=(0,i.getRules)(),E.call(this,v,$,"NOT SUPPORTED"),E.call(this,f,$,"DEPRECATED","warn"),this._metaOpts=U.call(this),$.formats&&C.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),$.keywords&&O.call(this,$.keywords),typeof $.meta=="object"&&this.addMetaSchema($.meta),k.call(this),$.validateFormats=x}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:$,meta:G,schemaId:D}=this.opts;let x=d;D==="id"&&(x={...d},x.id=x.$id,delete x.$id),G&&$&&this.addMetaSchema(x,x[D],!1)}defaultMeta(){const{meta:$,schemaId:G}=this.opts;return this.opts.defaultMeta=typeof $=="object"?$[G]||$:void 0}validate($,G){let D;if(typeof $=="string"){if(D=this.getSchema($),!D)throw new Error(`no schema with key or ref "${$}"`)}else D=this.compile($);const x=D(G);return"$async"in D||(this.errors=D.errors),x}compile($,G){const D=this._addSchema($,G);return D.validate||this._compileSchemaEnv(D)}compileAsync($,G){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:D}=this.opts;return x.call(this,$,G);async function x($e,it){await I.call(this,$e.$schema);const er=this._addSchema($e,it);return er.validate||F.call(this,er)}async function I($e){$e&&!this.getSchema($e)&&await x.call(this,{$ref:$e},!0)}async function F($e){try{return this._compileSchemaEnv($e)}catch(it){if(!(it instanceof o.default))throw it;return ne.call(this,it),await re.call(this,it.missingSchema),F.call(this,$e)}}function ne({missingSchema:$e,missingRef:it}){if(this.refs[$e])throw new Error(`AnySchema ${$e} is loaded but ${it} cannot be resolved`)}async function re($e){const it=await be.call(this,$e);this.refs[$e]||await I.call(this,it.$schema),this.refs[$e]||this.addSchema(it,$e,G)}async function be($e){const it=this._loading[$e];if(it)return it;try{return await(this._loading[$e]=D($e))}finally{delete this._loading[$e]}}}addSchema($,G,D,x=this.opts.validateSchema){if(Array.isArray($)){for(const F of $)this.addSchema(F,void 0,D,x);return this}let I;if(typeof $=="object"){const{schemaId:F}=this.opts;if(I=$[F],I!==void 0&&typeof I!="string")throw new Error(`schema ${F} must be string`)}return G=(0,l.normalizeId)(G||I),this._checkUnique(G),this.schemas[G]=this._addSchema($,D,G,x,!0),this}addMetaSchema($,G,D=this.opts.validateSchema){return this.addSchema($,G,!0,D),this}validateSchema($,G){if(typeof $=="boolean")return!0;let D;if(D=$.$schema,D!==void 0&&typeof D!="string")throw new Error("$schema must be a string");if(D=D||this.opts.defaultMeta||this.defaultMeta(),!D)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const x=this.validate(D,$);if(!x&&G){const I="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(I);else throw new Error(I)}return x}getSchema($){let G;for(;typeof(G=S.call(this,$))=="string";)$=G;if(G===void 0){const{schemaId:D}=this.opts,x=new s.SchemaEnv({schema:{},schemaId:D});if(G=s.resolveSchema.call(this,x,$),!G)return;this.refs[$]=G}return G.validate||this._compileSchemaEnv(G)}removeSchema($){if($ instanceof RegExp)return this._removeAllSchemas(this.schemas,$),this._removeAllSchemas(this.refs,$),this;switch(typeof $){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const G=S.call(this,$);return typeof G=="object"&&this._cache.delete(G.schema),delete this.schemas[$],delete this.refs[$],this}case"object":{const G=$;this._cache.delete(G);let D=$[this.opts.schemaId];return D&&(D=(0,l.normalizeId)(D),delete this.schemas[D],delete this.refs[D]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary($){for(const G of $)this.addKeyword(G);return this}addKeyword($,G){let D;if(typeof $=="string")D=$,typeof G=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),G.keyword=D);else if(typeof $=="object"&&G===void 0){if(G=$,D=G.keyword,Array.isArray(D)&&!D.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(j.call(this,D,G),!G)return(0,u.eachItem)(D,I=>q.call(this,I)),this;J.call(this,G);const x={...G,type:(0,c.getJSONTypes)(G.type),schemaType:(0,c.getJSONTypes)(G.schemaType)};return(0,u.eachItem)(D,x.type.length===0?I=>q.call(this,I,x):I=>x.type.forEach(F=>q.call(this,I,x,F))),this}getKeyword($){const G=this.RULES.all[$];return typeof G=="object"?G.definition:!!G}removeKeyword($){const{RULES:G}=this;delete G.keywords[$],delete G.all[$];for(const D of G.rules){const x=D.rules.findIndex(I=>I.keyword===$);x>=0&&D.rules.splice(x,1)}return this}addFormat($,G){return typeof G=="string"&&(G=new RegExp(G)),this.formats[$]=G,this}errorsText($=this.errors,{separator:G=", ",dataVar:D="data"}={}){return!$||$.length===0?"No errors":$.map(x=>`${D}${x.instancePath} ${x.message}`).reduce((x,I)=>x+G+I)}$dataMetaSchema($,G){const D=this.RULES.all;$=JSON.parse(JSON.stringify($));for(const x of G){const I=x.split("/").slice(1);let F=$;for(const ne of I)F=F[ne];for(const ne in D){const re=D[ne];if(typeof re!="object")continue;const{$data:be}=re.definition,$e=F[ne];be&&$e&&(F[ne]=Z($e))}}return $}_removeAllSchemas($,G){for(const D in $){const x=$[D];(!G||G.test(D))&&(typeof x=="string"?delete $[D]:x&&!x.meta&&(this._cache.delete(x.schema),delete $[D]))}}_addSchema($,G,D,x=this.opts.validateSchema,I=this.opts.addUsedSchema){let F;const{schemaId:ne}=this.opts;if(typeof $=="object")F=$[ne];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof $!="boolean")throw new Error("schema must be object or boolean")}let re=this._cache.get($);if(re!==void 0)return re;D=(0,l.normalizeId)(F||D);const be=l.getSchemaRefs.call(this,$,D);return re=new s.SchemaEnv({schema:$,schemaId:ne,meta:G,baseId:D,localRefs:be}),this._cache.set(re.schema,re),I&&!D.startsWith("#")&&(D&&this._checkUnique(D),this.refs[D]=re),x&&this.validateSchema($,!0),re}_checkUnique($){if(this.schemas[$]||this.refs[$])throw new Error(`schema with key or id "${$}" already exists`)}_compileSchemaEnv($){if($.meta?this._compileMetaSchema($):s.compileSchema.call(this,$),!$.validate)throw new Error("ajv implementation error");return $.validate}_compileMetaSchema($){const G=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,$)}finally{this.opts=G}}}_.ValidationError=r.default,_.MissingRefError=o.default,e.default=_;function E(W,$,G,D="error"){for(const x in W){const I=x;I in $&&this.logger[D](`${G}: option ${x}. ${W[I]}`)}}function S(W){return W=(0,l.normalizeId)(W),this.schemas[W]||this.refs[W]}function k(){const W=this.opts.schemas;if(W)if(Array.isArray(W))this.addSchema(W);else for(const $ in W)this.addSchema(W[$],$)}function C(){for(const W in this.opts.formats){const $=this.opts.formats[W];$&&this.addFormat(W,$)}}function O(W){if(Array.isArray(W)){this.addVocabulary(W);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const $ in W){const G=W[$];G.keyword||(G.keyword=$),this.addKeyword(G)}}function U(){const W={...this.opts};for(const $ of h)delete W[$];return W}const T={log(){},warn(){},error(){}};function A(W){if(W===!1)return T;if(W===void 0)return console;if(W.log&&W.warn&&W.error)return W;throw new Error("logger must implement log, warn and error methods")}const L=/^[a-z_$][a-z0-9_$:-]*$/i;function j(W,$){const{RULES:G}=this;if((0,u.eachItem)(W,D=>{if(G.keywords[D])throw new Error(`Keyword ${D} is already defined`);if(!L.test(D))throw new Error(`Keyword ${D} has invalid name`)}),!!$&&$.$data&&!("code"in $||"validate"in $))throw new Error('$data keyword must have "code" or "validate" function')}function q(W,$,G){var D;const x=$==null?void 0:$.post;if(G&&x)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:I}=this;let F=x?I.post:I.rules.find(({type:re})=>re===G);if(F||(F={type:G,rules:[]},I.rules.push(F)),I.keywords[W]=!0,!$)return;const ne={keyword:W,definition:{...$,type:(0,c.getJSONTypes)($.type),schemaType:(0,c.getJSONTypes)($.schemaType)}};$.before?K.call(this,F,ne,$.before):F.rules.push(ne),I.all[W]=ne,(D=$.implements)===null||D===void 0||D.forEach(re=>this.addKeyword(re))}function K(W,$,G){const D=W.rules.findIndex(x=>x.keyword===G);D>=0?W.rules.splice(D,0,$):(W.rules.push($),this.logger.warn(`rule ${G} is not defined`))}function J(W){let{metaSchema:$}=W;$!==void 0&&(W.$data&&this.opts.$data&&($=Z($)),W.validateSchema=this.compile($,!0))}const z={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Z(W){return{anyOf:[W,z]}}}(mx);var hw={},gw={},yw={};Object.defineProperty(yw,"__esModule",{value:!0});const h5={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};yw.default=h5;var ys={};Object.defineProperty(ys,"__esModule",{value:!0}),ys.callRef=ys.getValidate=void 0;const g5=Sa,mC=De,Fn=Ne,Ta=po,hC=Wn,Kp=se,y5={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:r}=e,{baseId:o,schemaEnv:i,validateName:s,opts:a,self:l}=r,{root:c}=i;if((n==="#"||n==="#/")&&o===c.baseId)return d();const u=hC.resolveRef.call(l,c,o,n);if(u===void 0)throw new g5.default(r.opts.uriResolver,o,n);if(u instanceof hC.SchemaEnv)return p(u);return m(u);function d(){if(i===c)return Zp(e,s,i,i.$async);const h=t.scopeValue("root",{ref:c});return Zp(e,(0,Fn._)`${h}.validate`,c,c.$async)}function p(h){const w=gC(e,h);Zp(e,w,h,h.$async)}function m(h){const w=t.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,Fn.stringify)(h)}:{ref:h}),v=t.name("valid"),f=e.subschema({schema:h,dataTypes:[],schemaPath:Fn.nil,topSchemaRef:w,errSchemaPath:n},v);e.mergeEvaluated(f),e.ok(v)}}};function gC(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):(0,Fn._)`${n.scopeValue("wrapper",{ref:t})}.validate`}ys.getValidate=gC;function Zp(e,t,n,r){const{gen:o,it:i}=e,{allErrors:s,schemaEnv:a,opts:l}=i,c=l.passContext?Ta.default.this:Fn.nil;r?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");const h=o.let("valid");o.try(()=>{o.code((0,Fn._)`await ${(0,mC.callValidateCode)(e,t,c)}`),m(t),s||o.assign(h,!0)},w=>{o.if((0,Fn._)`!(${w} instanceof ${i.ValidationError})`,()=>o.throw(w)),p(w),s||o.assign(h,!1)}),e.ok(h)}function d(){e.result((0,mC.callValidateCode)(e,t,c),()=>m(t),()=>p(t))}function p(h){const w=(0,Fn._)`${h}.errors`;o.assign(Ta.default.vErrors,(0,Fn._)`${Ta.default.vErrors} === null ? ${w} : ${Ta.default.vErrors}.concat(${w})`),o.assign(Ta.default.errors,(0,Fn._)`${Ta.default.vErrors}.length`)}function m(h){var w;if(!i.opts.unevaluated)return;const v=(w=n==null?void 0:n.validate)===null||w===void 0?void 0:w.evaluated;if(i.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(i.props=Kp.mergeEvaluated.props(o,v.props,i.props));else{const f=o.var("props",(0,Fn._)`${h}.evaluated.props`);i.props=Kp.mergeEvaluated.props(o,f,i.props,Fn.Name)}if(i.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(i.items=Kp.mergeEvaluated.items(o,v.items,i.items));else{const f=o.var("items",(0,Fn._)`${h}.evaluated.items`);i.items=Kp.mergeEvaluated.items(o,f,i.items,Fn.Name)}}}ys.callRef=Zp,ys.default=y5,Object.defineProperty(gw,"__esModule",{value:!0});const w5=yw,v5=ys,_5=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",w5.default,v5.default];gw.default=_5;var ww={},vw={};Object.defineProperty(vw,"__esModule",{value:!0});const Yp=Ne,Ei=Yp.operators,Jp={maximum:{okStr:"<=",ok:Ei.LTE,fail:Ei.GT},minimum:{okStr:">=",ok:Ei.GTE,fail:Ei.LT},exclusiveMaximum:{okStr:"<",ok:Ei.LT,fail:Ei.GTE},exclusiveMinimum:{okStr:">",ok:Ei.GT,fail:Ei.LTE}},b5={message:({keyword:e,schemaCode:t})=>(0,Yp.str)`must be ${Jp[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Yp._)`{comparison: ${Jp[e].okStr}, limit: ${t}}`},E5={keyword:Object.keys(Jp),type:"number",schemaType:"number",$data:!0,error:b5,code(e){const{keyword:t,data:n,schemaCode:r}=e;e.fail$data((0,Yp._)`${n} ${Jp[t].fail} ${r} || isNaN(${n})`)}};vw.default=E5;var _w={};Object.defineProperty(_w,"__esModule",{value:!0});const Uc=Ne,S5={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,Uc.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Uc._)`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:r,it:o}=e,i=o.opts.multipleOfPrecision,s=t.let("res"),a=i?(0,Uc._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:(0,Uc._)`${s} !== parseInt(${s})`;e.fail$data((0,Uc._)`(${r} === 0 || (${s} = ${n}/${r}, ${a}))`)}};_w.default=S5;var bw={},Ew={};Object.defineProperty(Ew,"__esModule",{value:!0});function yC(e){const t=e.length;let n=0,r=0,o;for(;r=55296&&o<=56319&&r(0,ws._)`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r,it:o}=e,i=t==="maxLength"?ws.operators.GT:ws.operators.LT,s=o.opts.unicode===!1?(0,ws._)`${n}.length`:(0,ws._)`${(0,T5.useFunc)(e.gen,k5.default)}(${n})`;e.fail$data((0,ws._)`${s} ${i} ${r}`)}};bw.default=x5;var Sw={};Object.defineProperty(Sw,"__esModule",{value:!0});const C5=De,I5=se,ka=Ne,P5={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,ka.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,ka._)`{pattern: ${e}}`},code(e){const{gen:t,data:n,$data:r,schema:o,schemaCode:i,it:s}=e,a=s.opts.unicodeRegExp?"u":"";if(r){const{regExp:l}=s.opts.code,c=l.code==="new RegExp"?(0,ka._)`new RegExp`:(0,I5.useFunc)(t,l),u=t.let("valid");t.try(()=>t.assign(u,(0,ka._)`${c}(${i}, ${a}).test(${n})`),()=>t.assign(u,!1)),e.fail$data((0,ka._)`!${u}`)}else{const l=(0,C5.usePattern)(e,o);e.fail$data((0,ka._)`!${l}.test(${n})`)}}};Sw.default=P5;var Tw={};Object.defineProperty(Tw,"__esModule",{value:!0});const jc=Ne,R5={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n=e==="maxProperties"?"more":"fewer";return(0,jc.str)`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>(0,jc._)`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,o=t==="maxProperties"?jc.operators.GT:jc.operators.LT;e.fail$data((0,jc._)`Object.keys(${n}).length ${o} ${r}`)}};Tw.default=R5;var kw={};Object.defineProperty(kw,"__esModule",{value:!0});const Wc=De,Fc=Ne,A5=se,$5={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,Fc.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Fc._)`{missingProperty: ${e}}`},code(e){const{gen:t,schema:n,schemaCode:r,data:o,$data:i,it:s}=e,{opts:a}=s;if(!i&&n.length===0)return;const l=n.length>=a.loopRequired;if(s.allErrors?c():u(),a.strictRequired){const m=e.parentSchema.properties,{definedProperties:h}=e.it;for(const w of n)if((m==null?void 0:m[w])===void 0&&!h.has(w)){const v=s.schemaEnv.baseId+s.errSchemaPath,f=`required property "${w}" is not defined at "${v}" (strictRequired)`;(0,A5.checkStrictMode)(s,f,s.opts.strictRequired)}}function c(){if(l||i)e.block$data(Fc.nil,d);else for(const m of n)(0,Wc.checkReportMissingProp)(e,m)}function u(){const m=t.let("missing");if(l||i){const h=t.let("valid",!0);e.block$data(h,()=>p(m,h)),e.ok(h)}else t.if((0,Wc.checkMissingProp)(e,n,m)),(0,Wc.reportMissingProp)(e,m),t.else()}function d(){t.forOf("prop",r,m=>{e.setParams({missingProperty:m}),t.if((0,Wc.noPropertyInData)(t,o,m,a.ownProperties),()=>e.error())})}function p(m,h){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(h,(0,Wc.propertyInData)(t,o,m,a.ownProperties)),t.if((0,Fc.not)(h),()=>{e.error(),t.break()})},Fc.nil)}}};kw.default=$5;var xw={};Object.defineProperty(xw,"__esModule",{value:!0});const zc=Ne,O5={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n=e==="maxItems"?"more":"fewer";return(0,zc.str)`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>(0,zc._)`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,o=t==="maxItems"?zc.operators.GT:zc.operators.LT;e.fail$data((0,zc._)`${n}.length ${o} ${r}`)}};xw.default=O5;var Cw={},Bc={};Object.defineProperty(Bc,"__esModule",{value:!0});const wC=Nx;wC.code='require("ajv/dist/runtime/equal").default',Bc.default=wC,Object.defineProperty(Cw,"__esModule",{value:!0});const Iw=qt,un=Ne,N5=se,L5=Bc,M5={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,un.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,un._)`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:n,$data:r,schema:o,parentSchema:i,schemaCode:s,it:a}=e;if(!r&&!o)return;const l=t.let("valid"),c=i.items?(0,Iw.getSchemaTypes)(i.items):[];e.block$data(l,u,(0,un._)`${s} === false`),e.ok(l);function u(){const h=t.let("i",(0,un._)`${n}.length`),w=t.let("j");e.setParams({i:h,j:w}),t.assign(l,!0),t.if((0,un._)`${h} > 1`,()=>(d()?p:m)(h,w))}function d(){return c.length>0&&!c.some(h=>h==="object"||h==="array")}function p(h,w){const v=t.name("item"),f=(0,Iw.checkDataTypes)(c,v,a.opts.strictNumbers,Iw.DataType.Wrong),g=t.const("indices",(0,un._)`{}`);t.for((0,un._)`;${h}--;`,()=>{t.let(v,(0,un._)`${n}[${h}]`),t.if(f,(0,un._)`continue`),c.length>1&&t.if((0,un._)`typeof ${v} == "string"`,(0,un._)`${v} += "_"`),t.if((0,un._)`typeof ${g}[${v}] == "number"`,()=>{t.assign(w,(0,un._)`${g}[${v}]`),e.error(),t.assign(l,!1).break()}).code((0,un._)`${g}[${v}] = ${h}`)})}function m(h,w){const v=(0,N5.useFunc)(t,L5.default),f=t.name("outer");t.label(f).for((0,un._)`;${h}--;`,()=>t.for((0,un._)`${w} = ${h}; ${w}--;`,()=>t.if((0,un._)`${v}(${n}[${h}], ${n}[${w}])`,()=>{e.error(),t.assign(l,!1).break(f)})))}}};Cw.default=M5;var Pw={};Object.defineProperty(Pw,"__esModule",{value:!0});const Rw=Ne,D5=se,U5=Bc,j5={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,Rw._)`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:r,schemaCode:o,schema:i}=e;r||i&&typeof i=="object"?e.fail$data((0,Rw._)`!${(0,D5.useFunc)(t,U5.default)}(${n}, ${o})`):e.fail((0,Rw._)`${i} !== ${n}`)}};Pw.default=j5;var Aw={};Object.defineProperty(Aw,"__esModule",{value:!0});const Gc=Ne,W5=se,F5=Bc,z5={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Gc._)`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:r,schema:o,schemaCode:i,it:s}=e;if(!r&&o.length===0)throw new Error("enum must have non-empty array");const a=o.length>=s.opts.loopEnum;let l;const c=()=>l??(l=(0,W5.useFunc)(t,F5.default));let u;if(a||r)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");const m=t.const("vSchema",i);u=(0,Gc.or)(...o.map((h,w)=>p(m,w)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",i,m=>t.if((0,Gc._)`${c()}(${n}, ${m})`,()=>t.assign(u,!0).break()))}function p(m,h){const w=o[h];return typeof w=="object"&&w!==null?(0,Gc._)`${c()}(${n}, ${m}[${h}])`:(0,Gc._)`${n} === ${w}`}}};Aw.default=z5,Object.defineProperty(ww,"__esModule",{value:!0});const B5=vw,G5=_w,H5=bw,q5=Sw,V5=Tw,K5=kw,Z5=xw,Y5=Cw,J5=Pw,X5=Aw,Q5=[B5.default,G5.default,H5.default,q5.default,V5.default,K5.default,Z5.default,Y5.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},J5.default,X5.default];ww.default=Q5;var $w={},xa={};Object.defineProperty(xa,"__esModule",{value:!0}),xa.validateAdditionalItems=void 0;const vs=Ne,Ow=se,eG={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,vs.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,vs._)`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){(0,Ow.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}vC(e,r)}};function vC(e,t){const{gen:n,schema:r,data:o,keyword:i,it:s}=e;s.items=!0;const a=n.const("len",(0,vs._)`${o}.length`);if(r===!1)e.setParams({len:t.length}),e.pass((0,vs._)`${a} <= ${t.length}`);else if(typeof r=="object"&&!(0,Ow.alwaysValidSchema)(s,r)){const c=n.var("valid",(0,vs._)`${a} <= ${t.length}`);n.if((0,vs.not)(c),()=>l(c)),e.ok(c)}function l(c){n.forRange("i",t.length,a,u=>{e.subschema({keyword:i,dataProp:u,dataPropType:Ow.Type.Num},c),s.allErrors||n.if((0,vs.not)(c),()=>n.break())})}}xa.validateAdditionalItems=vC,xa.default=eG;var Nw={},Ca={};Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.validateTuple=void 0;const _C=Ne,Xp=se,tG=De,nG={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return bC(e,"additionalItems",t);n.items=!0,!(0,Xp.alwaysValidSchema)(n,t)&&e.ok((0,tG.validateArray)(e))}};function bC(e,t,n=e.schema){const{gen:r,parentSchema:o,data:i,keyword:s,it:a}=e;u(o),a.opts.unevaluated&&n.length&&a.items!==!0&&(a.items=Xp.mergeEvaluated.items(r,n.length,a.items));const l=r.name("valid"),c=r.const("len",(0,_C._)`${i}.length`);n.forEach((d,p)=>{(0,Xp.alwaysValidSchema)(a,d)||(r.if((0,_C._)`${c} > ${p}`,()=>e.subschema({keyword:s,schemaProp:p,dataProp:p},l)),e.ok(l))});function u(d){const{opts:p,errSchemaPath:m}=a,h=n.length,w=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(p.strictTuples&&!w){const v=`"${s}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,Xp.checkStrictMode)(a,v,p.strictTuples)}}}Ca.validateTuple=bC,Ca.default=nG,Object.defineProperty(Nw,"__esModule",{value:!0});const rG=Ca,oG={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,rG.validateTuple)(e,"items")};Nw.default=oG;var Lw={};Object.defineProperty(Lw,"__esModule",{value:!0});const EC=Ne,iG=se,sG=De,aG=xa,lG={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,EC.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,EC._)`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:r}=e,{prefixItems:o}=n;r.items=!0,!(0,iG.alwaysValidSchema)(r,t)&&(o?(0,aG.validateAdditionalItems)(e,o):e.ok((0,sG.validateArray)(e)))}};Lw.default=lG;var Mw={};Object.defineProperty(Mw,"__esModule",{value:!0});const br=Ne,Qp=se,cG={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>t===void 0?(0,br.str)`must contain at least ${e} valid item(s)`:(0,br.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,br._)`{minContains: ${e}}`:(0,br._)`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:r,data:o,it:i}=e;let s,a;const{minContains:l,maxContains:c}=r;i.opts.next?(s=l===void 0?1:l,a=c):s=1;const u=t.const("len",(0,br._)`${o}.length`);if(e.setParams({min:s,max:a}),a===void 0&&s===0){(0,Qp.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,Qp.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Qp.alwaysValidSchema)(i,n)){let w=(0,br._)`${u} >= ${s}`;a!==void 0&&(w=(0,br._)`${w} && ${u} <= ${a}`),e.pass(w);return}i.items=!0;const d=t.name("valid");a===void 0&&s===1?m(d,()=>t.if(d,()=>t.break())):s===0?(t.let(d,!0),a!==void 0&&t.if((0,br._)`${o}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset());function p(){const w=t.name("_valid"),v=t.let("count",0);m(w,()=>t.if(w,()=>h(v)))}function m(w,v){t.forRange("i",0,u,f=>{e.subschema({keyword:"contains",dataProp:f,dataPropType:Qp.Type.Num,compositeRule:!0},w),v()})}function h(w){t.code((0,br._)`${w}++`),a===void 0?t.if((0,br._)`${w} >= ${s}`,()=>t.assign(d,!0).break()):(t.if((0,br._)`${w} > ${a}`,()=>t.assign(d,!1).break()),s===1?t.assign(d,!0):t.if((0,br._)`${w} >= ${s}`,()=>t.assign(d,!0)))}}};Mw.default=cG;var SC={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=Ne,n=se,r=De;e.error={message:({params:{property:l,depsCount:c,deps:u}})=>{const d=c===1?"property":"properties";return(0,t.str)`must have ${d} ${u} when property ${l} is present`},params:({params:{property:l,depsCount:c,deps:u,missingProperty:d}})=>(0,t._)`{property: ${l}, missingProperty: ${d}, depsCount: ${c}, deps: ${u}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(l){const[c,u]=i(l);s(l,c),a(l,u)}};function i({schema:l}){const c={},u={};for(const d in l){if(d==="__proto__")continue;const p=Array.isArray(l[d])?c:u;p[d]=l[d]}return[c,u]}function s(l,c=l.schema){const{gen:u,data:d,it:p}=l;if(Object.keys(c).length===0)return;const m=u.let("missing");for(const h in c){const w=c[h];if(w.length===0)continue;const v=(0,r.propertyInData)(u,d,h,p.opts.ownProperties);l.setParams({property:h,depsCount:w.length,deps:w.join(", ")}),p.allErrors?u.if(v,()=>{for(const f of w)(0,r.checkReportMissingProp)(l,f)}):(u.if((0,t._)`${v} && (${(0,r.checkMissingProp)(l,w,m)})`),(0,r.reportMissingProp)(l,m),u.else())}}e.validatePropertyDeps=s;function a(l,c=l.schema){const{gen:u,data:d,keyword:p,it:m}=l,h=u.name("valid");for(const w in c)(0,n.alwaysValidSchema)(m,c[w])||(u.if((0,r.propertyInData)(u,d,w,m.opts.ownProperties),()=>{const v=l.subschema({keyword:p,schemaProp:w},h);l.mergeValidEvaluated(v,h)},()=>u.var(h,!0)),l.ok(h))}e.validateSchemaDeps=a,e.default=o})(SC);var Dw={};Object.defineProperty(Dw,"__esModule",{value:!0});const TC=Ne,uG=se,dG={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,TC._)`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:r,it:o}=e;if((0,uG.alwaysValidSchema)(o,n))return;const i=t.name("valid");t.forIn("key",r,s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),t.if((0,TC.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};Dw.default=dG;var ef={};Object.defineProperty(ef,"__esModule",{value:!0});const tf=De,Jr=Ne,pG=po,nf=se,fG={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,Jr._)`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:n,parentSchema:r,data:o,errsCount:i,it:s}=e;if(!i)throw new Error("ajv implementation error");const{allErrors:a,opts:l}=s;if(s.props=!0,l.removeAdditional!=="all"&&(0,nf.alwaysValidSchema)(s,n))return;const c=(0,tf.allSchemaProperties)(r.properties),u=(0,tf.allSchemaProperties)(r.patternProperties);d(),e.ok((0,Jr._)`${i} === ${pG.default.errors}`);function d(){t.forIn("key",o,v=>{!c.length&&!u.length?h(v):t.if(p(v),()=>h(v))})}function p(v){let f;if(c.length>8){const g=(0,nf.schemaRefOrVal)(s,r.properties,"properties");f=(0,tf.isOwnProperty)(t,g,v)}else c.length?f=(0,Jr.or)(...c.map(g=>(0,Jr._)`${v} === ${g}`)):f=Jr.nil;return u.length&&(f=(0,Jr.or)(f,...u.map(g=>(0,Jr._)`${(0,tf.usePattern)(e,g)}.test(${v})`))),(0,Jr.not)(f)}function m(v){t.code((0,Jr._)`delete ${o}[${v}]`)}function h(v){if(l.removeAdditional==="all"||l.removeAdditional&&n===!1){m(v);return}if(n===!1){e.setParams({additionalProperty:v}),e.error(),a||t.break();return}if(typeof n=="object"&&!(0,nf.alwaysValidSchema)(s,n)){const f=t.name("valid");l.removeAdditional==="failing"?(w(v,f,!1),t.if((0,Jr.not)(f),()=>{e.reset(),m(v)})):(w(v,f),a||t.if((0,Jr.not)(f),()=>t.break()))}}function w(v,f,g){const y={keyword:"additionalProperties",dataProp:v,dataPropType:nf.Type.Str};g===!1&&Object.assign(y,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(y,f)}}};ef.default=fG;var Uw={};Object.defineProperty(Uw,"__esModule",{value:!0});const mG=Kr,kC=De,jw=se,xC=ef,hG={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:r,data:o,it:i}=e;i.opts.removeAdditional==="all"&&r.additionalProperties===void 0&&xC.default.code(new mG.KeywordCxt(i,xC.default,"additionalProperties"));const s=(0,kC.allSchemaProperties)(n);for(const d of s)i.definedProperties.add(d);i.opts.unevaluated&&s.length&&i.props!==!0&&(i.props=jw.mergeEvaluated.props(t,(0,jw.toHash)(s),i.props));const a=s.filter(d=>!(0,jw.alwaysValidSchema)(i,n[d]));if(a.length===0)return;const l=t.name("valid");for(const d of a)c(d)?u(d):(t.if((0,kC.propertyInData)(t,o,d,i.opts.ownProperties)),u(d),i.allErrors||t.else().var(l,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(l);function c(d){return i.opts.useDefaults&&!i.compositeRule&&n[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};Uw.default=hG;var Ww={};Object.defineProperty(Ww,"__esModule",{value:!0});const CC=De,rf=Ne,IC=se,PC=se,gG={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:r,parentSchema:o,it:i}=e,{opts:s}=i,a=(0,CC.allSchemaProperties)(n),l=a.filter(w=>(0,IC.alwaysValidSchema)(i,n[w]));if(a.length===0||l.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;const c=s.strictSchema&&!s.allowMatchingProperties&&o.properties,u=t.name("valid");i.props!==!0&&!(i.props instanceof rf.Name)&&(i.props=(0,PC.evaluatedPropsToName)(t,i.props));const{props:d}=i;p();function p(){for(const w of a)c&&m(w),i.allErrors?h(w):(t.var(u,!0),h(w),t.if(u))}function m(w){for(const v in c)new RegExp(w).test(v)&&(0,IC.checkStrictMode)(i,`property ${v} matches pattern ${w} (use allowMatchingProperties)`)}function h(w){t.forIn("key",r,v=>{t.if((0,rf._)`${(0,CC.usePattern)(e,w)}.test(${v})`,()=>{const f=l.includes(w);f||e.subschema({keyword:"patternProperties",schemaProp:w,dataProp:v,dataPropType:PC.Type.Str},u),i.opts.unevaluated&&d!==!0?t.assign((0,rf._)`${d}[${v}]`,!0):!f&&!i.allErrors&&t.if((0,rf.not)(u),()=>t.break())})})}}};Ww.default=gG;var Fw={};Object.defineProperty(Fw,"__esModule",{value:!0});const yG=se,wG={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:r}=e;if((0,yG.alwaysValidSchema)(r,n)){e.fail();return}const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Fw.default=wG;var zw={};Object.defineProperty(zw,"__esModule",{value:!0});const vG={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:De.validateUnion,error:{message:"must match a schema in anyOf"}};zw.default=vG;var Bw={};Object.defineProperty(Bw,"__esModule",{value:!0});const of=Ne,_G=se,bG={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,of._)`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:n,parentSchema:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&r.discriminator)return;const i=n,s=t.let("valid",!1),a=t.let("passing",null),l=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(s,()=>e.reset(),()=>e.error(!0));function c(){i.forEach((u,d)=>{let p;(0,_G.alwaysValidSchema)(o,u)?t.var(l,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&t.if((0,of._)`${l} && ${s}`).assign(s,!1).assign(a,(0,of._)`[${a}, ${d}]`).else(),t.if(l,()=>{t.assign(s,!0),t.assign(a,d),p&&e.mergeEvaluated(p,of.Name)})})}}};Bw.default=bG;var Gw={};Object.defineProperty(Gw,"__esModule",{value:!0});const EG=se,SG={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const o=t.name("valid");n.forEach((i,s)=>{if((0,EG.alwaysValidSchema)(r,i))return;const a=e.subschema({keyword:"allOf",schemaProp:s},o);e.ok(o),e.mergeEvaluated(a)})}};Gw.default=SG;var Hw={};Object.defineProperty(Hw,"__esModule",{value:!0});const sf=Ne,RC=se,TG={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,sf.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,sf._)`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:r}=e;n.then===void 0&&n.else===void 0&&(0,RC.checkStrictMode)(r,'"if" without "then" and "else" is ignored');const o=AC(r,"then"),i=AC(r,"else");if(!o&&!i)return;const s=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),o&&i){const u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,c("then",u),c("else",u))}else o?t.if(a,c("then")):t.if((0,sf.not)(a),c("else"));e.pass(s,()=>e.error(!0));function l(){const u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function c(u,d){return()=>{const p=e.subschema({keyword:u},a);t.assign(s,a),e.mergeValidEvaluated(p,s),d?t.assign(d,(0,sf._)`${u}`):e.setParams({ifClause:u})}}}};function AC(e,t){const n=e.schema[t];return n!==void 0&&!(0,RC.alwaysValidSchema)(e,n)}Hw.default=TG;var qw={};Object.defineProperty(qw,"__esModule",{value:!0});const kG=se,xG={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){t.if===void 0&&(0,kG.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};qw.default=xG,Object.defineProperty($w,"__esModule",{value:!0});const CG=xa,IG=Nw,PG=Ca,RG=Lw,AG=Mw,$G=SC,OG=Dw,NG=ef,LG=Uw,MG=Ww,DG=Fw,UG=zw,jG=Bw,WG=Gw,FG=Hw,zG=qw;function BG(e=!1){const t=[DG.default,UG.default,jG.default,WG.default,FG.default,zG.default,OG.default,NG.default,$G.default,LG.default,MG.default];return e?t.push(IG.default,RG.default):t.push(CG.default,PG.default),t.push(AG.default),t}$w.default=BG;var Vw={},Kw={};Object.defineProperty(Kw,"__esModule",{value:!0});const Ut=Ne,GG={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,Ut.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Ut._)`{format: ${e}}`},code(e,t){const{gen:n,data:r,$data:o,schema:i,schemaCode:s,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=a;if(!l.validateFormats)return;o?p():m();function p(){const h=n.scopeValue("formats",{ref:d.formats,code:l.code.formats}),w=n.const("fDef",(0,Ut._)`${h}[${s}]`),v=n.let("fType"),f=n.let("format");n.if((0,Ut._)`typeof ${w} == "object" && !(${w} instanceof RegExp)`,()=>n.assign(v,(0,Ut._)`${w}.type || "string"`).assign(f,(0,Ut._)`${w}.validate`),()=>n.assign(v,(0,Ut._)`"string"`).assign(f,w)),e.fail$data((0,Ut.or)(g(),y()));function g(){return l.strictSchema===!1?Ut.nil:(0,Ut._)`${s} && !${f}`}function y(){const _=u.$async?(0,Ut._)`(${w}.async ? await ${f}(${r}) : ${f}(${r}))`:(0,Ut._)`${f}(${r})`,E=(0,Ut._)`(typeof ${f} == "function" ? ${_} : ${f}.test(${r}))`;return(0,Ut._)`${f} && ${f} !== true && ${v} === ${t} && !${E}`}}function m(){const h=d.formats[i];if(!h){g();return}if(h===!0)return;const[w,v,f]=y(h);w===t&&e.pass(_());function g(){if(l.strictSchema===!1){d.logger.warn(E());return}throw new Error(E());function E(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function y(E){const S=E instanceof RegExp?(0,Ut.regexpCode)(E):l.code.formats?(0,Ut._)`${l.code.formats}${(0,Ut.getProperty)(i)}`:void 0,k=n.scopeValue("formats",{key:i,ref:E,code:S});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,(0,Ut._)`${k}.validate`]:["string",E,k]}function _(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Ut._)`await ${f}(${r})`}return typeof v=="function"?(0,Ut._)`${f}(${r})`:(0,Ut._)`${f}.test(${r})`}}}};Kw.default=GG,Object.defineProperty(Vw,"__esModule",{value:!0});const HG=[Kw.default];Vw.default=HG;var Ia={};Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.contentVocabulary=Ia.metadataVocabulary=void 0,Ia.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Ia.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"],Object.defineProperty(hw,"__esModule",{value:!0});const qG=gw,VG=ww,KG=$w,ZG=Vw,$C=Ia,YG=[qG.default,VG.default,(0,KG.default)(),ZG.default,$C.metadataVocabulary,$C.contentVocabulary];hw.default=YG;var Zw={},af={};Object.defineProperty(af,"__esModule",{value:!0}),af.DiscrError=void 0;var OC;(function(e){e.Tag="tag",e.Mapping="mapping"})(OC||(af.DiscrError=OC={})),Object.defineProperty(Zw,"__esModule",{value:!0});const Pa=Ne,Yw=af,NC=Wn,JG=Sa,XG=se,QG={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===Yw.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>(0,Pa._)`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:r,parentSchema:o,it:i}=e,{oneOf:s}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");const a=r.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");const l=t.let("valid",!1),c=t.const("tag",(0,Pa._)`${n}${(0,Pa.getProperty)(a)}`);t.if((0,Pa._)`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:Yw.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function u(){const m=p();t.if(!1);for(const h in m)t.elseIf((0,Pa._)`${c} === ${h}`),t.assign(l,d(m[h]));t.else(),e.error(!1,{discrError:Yw.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(m){const h=t.name("valid"),w=e.subschema({keyword:"oneOf",schemaProp:m},h);return e.mergeEvaluated(w,Pa.Name),h}function p(){var m;const h={},w=f(o);let v=!0;for(let _=0;_this.addVocabulary(h)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const h=this.opts.$data?this.$dataMetaSchema(i,s):i;this.addMetaSchema(h,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}t.Ajv=l,e.exports=t=l,e.exports.Ajv=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=Kr;Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=Ne;Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=Mc;Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=Sa;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})(Ky,Ky.exports);var LC=Ky.exports;const t3=Ac(LC);var Jw={exports:{}},MC={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(T,A){return{validate:T,compare:A}}e.fullFormats={date:t(i,s),time:t(l(!0),c),"date-time":t(p(!0),m),"iso-time":t(l(),u),"iso-date-time":t(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:f,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:U,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:y,int32:{type:"number",validate:S},int64:{type:"number",validate:k},float:{type:"number",validate:C},double:{type:"number",validate:C},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,m),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(T){return T%4===0&&(T%100!==0||T%400===0)}const r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(T){const A=r.exec(T);if(!A)return!1;const L=+A[1],j=+A[2],q=+A[3];return j>=1&&j<=12&&q>=1&&q<=(j===2&&n(L)?29:o[j])}function s(T,A){if(T&&A)return T>A?1:T23||$>59||T&&!z)return!1;if(q<=23&&K<=59&&J<60)return!0;const G=K-$*Z,D=q-W*Z-(G<0?1:0);return(D===23||D===-1)&&(G===59||G===-1)&&J<61}}function c(T,A){if(!(T&&A))return;const L=new Date("2020-01-01T"+T).valueOf(),j=new Date("2020-01-01T"+A).valueOf();if(L&&j)return L-j}function u(T,A){if(!(T&&A))return;const L=a.exec(T),j=a.exec(A);if(L&&j)return T=L[1]+L[2]+L[3],A=j[1]+j[2]+j[3],T>A?1:T=_}function k(T){return Number.isInteger(T)}function C(){return!0}const O=/[^\\]\\Z/;function U(T){if(O.test(T))return!1;try{return new RegExp(T),!0}catch{return!1}}})(MC);var DC={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=LC,n=Ne,r=n.operators,o={formatMaximum:{okStr:"<=",ok:r.LTE,fail:r.GT},formatMinimum:{okStr:">=",ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},i={message:({keyword:a,schemaCode:l})=>(0,n.str)`should be ${o[a].okStr} ${l}`,params:({keyword:a,schemaCode:l})=>(0,n._)`{comparison: ${o[a].okStr}, limit: ${l}}`};e.formatLimitDefinition={keyword:Object.keys(o),type:"string",schemaType:"string",$data:!0,error:i,code(a){const{gen:l,data:c,schemaCode:u,keyword:d,it:p}=a,{opts:m,self:h}=p;if(!m.validateFormats)return;const w=new t.KeywordCxt(p,h.RULES.all.format.definition,"format");w.$data?v():f();function v(){const y=l.scopeValue("formats",{ref:h.formats,code:m.code.formats}),_=l.const("fmt",(0,n._)`${y}[${w.schemaCode}]`);a.fail$data((0,n.or)((0,n._)`typeof ${_} != "object"`,(0,n._)`${_} instanceof RegExp`,(0,n._)`typeof ${_}.compare != "function"`,g(_)))}function f(){const y=w.schema,_=h.formats[y];if(!_||_===!0)return;if(typeof _!="object"||_ instanceof RegExp||typeof _.compare!="function")throw new Error(`"${d}": format "${y}" does not define "compare" function`);const E=l.scopeValue("formats",{key:y,ref:_,code:m.code.formats?(0,n._)`${m.code.formats}${(0,n.getProperty)(y)}`:void 0});a.fail$data(g(E))}function g(y){return(0,n._)`${y}.compare(${c}, ${u}) ${o[d].fail} 0`}},dependencies:["format"]};const s=a=>(a.addKeyword(e.formatLimitDefinition),a);e.default=s})(DC),function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const n=MC,r=DC,o=Ne,i=new o.Name("fullFormats"),s=new o.Name("fastFormats"),a=(c,u={keywords:!0})=>{if(Array.isArray(u))return l(c,u,n.fullFormats,i),c;const[d,p]=u.mode==="fast"?[n.fastFormats,s]:[n.fullFormats,i],m=u.formats||n.formatNames;return l(c,m,d,p),u.keywords&&(0,r.default)(c),c};a.get=(c,u="full")=>{const p=(u==="fast"?n.fastFormats:n.fullFormats)[c];if(!p)throw new Error(`Unknown format "${c}"`);return p};function l(c,u,d,p){var m,h;(m=(h=c.opts.code).formats)!==null&&m!==void 0||(h.formats=(0,o._)`require("ajv-formats/dist/formats").${p}`);for(const w of u)c.addFormat(w,d[w])}e.exports=t=a,Object.defineProperty(t,"__esModule",{value:!0}),t.default=a}(Jw,Jw.exports);var n3=Jw.exports;const r3=Ac(n3);function o3(){const e=new t3({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return r3(e),e}class i3{constructor(t){this._ajv=t??o3()}getValidator(t){const n="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return r=>n(r)?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}}class s3{constructor(t){this._server=t}requestStream(t,n,r){return this._server.requestStream(t,n,r)}createMessageStream(t,n){var o;const r=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!((o=r==null?void 0:r.sampling)!=null&&o.tools))throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){const i=t.messages[t.messages.length-1],s=Array.isArray(i.content)?i.content:[i.content],a=s.some(d=>d.type==="tool_result"),l=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=l?Array.isArray(l.content)?l.content:[l.content]:[],u=c.some(d=>d.type==="tool_use");if(a){if(s.some(d=>d.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){const d=new Set(c.filter(m=>m.type==="tool_use").map(m=>m.id)),p=new Set(s.filter(m=>m.type==="tool_result").map(m=>m.toolUseId));if(d.size!==p.size||![...d].every(m=>p.has(m)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},Mp,n)}elicitInputStream(t,n){var s,a;const r=this._server.getClientCapabilities(),o=t.mode??"form";switch(o){case"url":{if(!((s=r==null?void 0:r.elicitation)!=null&&s.url))throw new Error("Client does not support url elicitation.");break}case"form":{if(!((a=r==null?void 0:r.elicitation)!=null&&a.form))throw new Error("Client does not support form elicitation.");break}}const i=o==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:i},Rc,n)}async getTask(t,n){return this._server.getTask({taskId:t},n)}async getTaskResult(t,n,r){return this._server.getTaskResult({taskId:t},n,r)}async listTasks(t,n){return this._server.listTasks(t?{cursor:t}:void 0,n)}async cancelTask(t,n){return this._server.cancelTask({taskId:t},n)}}function a3(e,t,n){var r;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!((r=e.tools)!=null&&r.call))throw new Error(`${n} does not support task creation for tools/call (required for ${t})`);break}}function l3(e,t,n){var r,o;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!((r=e.sampling)!=null&&r.createMessage))throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!((o=e.elicitation)!=null&&o.create))throw new Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break}}class c3 extends H4{constructor(t,n){super(n),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Cc.options.map((r,o)=>[r,o])),this.isMessageIgnored=(r,o)=>{const i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(r)this._oninitialize(r)),this.setNotificationHandler(mp,()=>{var r;return(r=this.oninitialized)==null?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(zy,async(r,o)=>{var l;const i=o.sessionId||((l=o.requestInfo)==null?void 0:l.headers["mcp-session-id"])||void 0,{level:s}=r.params,a=Cc.safeParse(s);return a.success&&this._loggingLevels.set(i,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new s3(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=q4(this._capabilities,t)}setRequestHandler(t,n){var a;const r=vc(t),o=r==null?void 0:r.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(uo(o)){const l=o,c=(a=l._zod)==null?void 0:a.def;i=(c==null?void 0:c.value)??l.value}else{const l=o,c=l._def;i=(c==null?void 0:c.value)??l.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){const l=async(c,u)=>{const d=wc(xc,c);if(!d.success){const w=d.error instanceof Error?d.error.message:String(d.error);throw new he(_e.InvalidParams,`Invalid tools/call request: ${w}`)}const{params:p}=d.data,m=await Promise.resolve(n(c,u));if(p.task){const w=wc(Tc,m);if(!w.success){const v=w.error instanceof Error?w.error.message:String(w.error);throw new he(_e.InvalidParams,`Invalid task creation result: ${v}`)}return w.data}const h=wc(Lp,m);if(!h.success){const w=h.error instanceof Error?h.error.message:String(h.error);throw new he(_e.InvalidParams,`Invalid tools/call result: ${w}`)}return h.data};return super.setRequestHandler(t,l)}return super.setRequestHandler(t,n)}assertCapabilityForMethod(t){var n,r,o;switch(t){case"sampling/createMessage":if(!((n=this._clientCapabilities)!=null&&n.sampling))throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!((r=this._clientCapabilities)!=null&&r.elicitation))throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!((o=this._clientCapabilities)!=null&&o.roots))throw new Error(`Client does not support listing roots (required for ${t})`);break}}assertNotificationCapability(t){var n,r;switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!((r=(n=this._clientCapabilities)==null?void 0:n.elicitation)!=null&&r.url))throw new Error(`Client does not support URL elicitation (required for ${t})`);break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break}}assertTaskCapability(t){var n,r;l3((r=(n=this._clientCapabilities)==null?void 0:n.tasks)==null?void 0:r.requests,t,"Client")}assertTaskHandlerCapability(t){var n;this._capabilities&&a3((n=this._capabilities.tasks)==null?void 0:n.requests,t,"Server")}async _oninitialize(t){const n=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:CT.includes(n)?n:Ty,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},dp)}async createMessage(t,n){var r,o;if((t.tools||t.toolChoice)&&!((o=(r=this._clientCapabilities)==null?void 0:r.sampling)!=null&&o.tools))throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){const i=t.messages[t.messages.length-1],s=Array.isArray(i.content)?i.content:[i.content],a=s.some(d=>d.type==="tool_result"),l=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=l?Array.isArray(l.content)?l.content:[l.content]:[],u=c.some(d=>d.type==="tool_use");if(a){if(s.some(d=>d.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){const d=new Set(c.filter(m=>m.type==="tool_use").map(m=>m.id)),p=new Set(s.filter(m=>m.type==="tool_result").map(m=>m.toolUseId));if(d.size!==p.size||![...d].every(m=>p.has(m)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},By,n):this.request({method:"sampling/createMessage",params:t},Mp,n)}async elicitInput(t,n){var o,i,s,a;switch(t.mode??"form"){case"url":{if(!((i=(o=this._clientCapabilities)==null?void 0:o.elicitation)!=null&&i.url))throw new Error("Client does not support url elicitation.");const l=t;return this.request({method:"elicitation/create",params:l},Rc,n)}case"form":{if(!((a=(s=this._clientCapabilities)==null?void 0:s.elicitation)!=null&&a.form))throw new Error("Client does not support form elicitation.");const l=t.mode==="form"?t:{...t,mode:"form"},c=await this.request({method:"elicitation/create",params:l},Rc,n);if(c.action==="accept"&&c.content&&l.requestedSchema)try{const d=this._jsonSchemaValidator.getValidator(l.requestedSchema)(c.content);if(!d.valid)throw new he(_e.InvalidParams,`Elicitation response content does not match requested schema: ${d.errorMessage}`)}catch(u){throw u instanceof he?u:new he(_e.InternalError,`Error validating elicitation response: ${u instanceof Error?u.message:String(u)}`)}return c}}}createElicitationCompletionNotifier(t,n){var r,o;if(!((o=(r=this._clientCapabilities)==null?void 0:r.elicitation)!=null&&o.url))throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},n)}async listRoots(t,n){return this.request({method:"roots/list",params:t},Hy,n)}async sendLoggingMessage(t,n){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,n))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}const UC=Symbol.for("mcp.completable");function jC(e){return!!e&&typeof e=="object"&&UC in e}function u3(e){const t=e[UC];return t==null?void 0:t.complete}var WC;(function(e){e.Completable="McpCompletable"})(WC||(WC={}));const FC=1e6,Xw=1e6,zC=1e4,d3=1e6;class Si{static isTemplate(t){return/\{[^}\s]+\}/.test(t)}static validateLength(t,n,r){if(t.length>n)throw new Error(`${r} exceeds maximum length of ${n} characters (got ${t.length})`)}get variableNames(){return this.parts.flatMap(t=>typeof t=="string"?[]:t.names)}constructor(t){Si.validateLength(t,FC,"Template"),this.template=t,this.parts=this.parse(t)}toString(){return this.template}parse(t){const n=[];let r="",o=0,i=0;for(;ozC)throw new Error(`Template contains too many expressions (max ${zC})`);const a=t.slice(o+1,s),l=this.getOperator(a),c=a.includes("*"),u=this.getNames(a),d=u[0];for(const p of u)Si.validateLength(p,Xw,"Variable name");n.push({name:d,operator:l,names:u,exploded:c}),o=s+1}else r+=t[o],o++;return r&&n.push(r),n}getOperator(t){return["+","#",".","/","?","&"].find(r=>t.startsWith(r))||""}getNames(t){const n=this.getOperator(t);return t.slice(n.length).split(",").map(r=>r.replace("*","").trim()).filter(r=>r.length>0)}encodeValue(t,n){return Si.validateLength(t,Xw,"Variable value"),n==="+"||n==="#"?encodeURI(t):encodeURIComponent(t)}expandPart(t,n){if(t.operator==="?"||t.operator==="&"){const s=t.names.map(l=>{const c=n[l];if(c===void 0)return"";const u=Array.isArray(c)?c.map(d=>this.encodeValue(d,t.operator)).join(","):this.encodeValue(c.toString(),t.operator);return`${l}=${u}`}).filter(l=>l.length>0);return s.length===0?"":(t.operator==="?"?"?":"&")+s.join("&")}if(t.names.length>1){const s=t.names.map(a=>n[a]).filter(a=>a!==void 0);return s.length===0?"":s.map(a=>Array.isArray(a)?a[0]:a).join(",")}const r=n[t.name];if(r===void 0)return"";const i=(Array.isArray(r)?r:[r]).map(s=>this.encodeValue(s,t.operator));switch(t.operator){case"":return i.join(",");case"+":return i.join(",");case"#":return"#"+i.join(",");case".":return"."+i.join(".");case"/":return"/"+i.join("/");default:return i.join(",")}}expand(t){let n="",r=!1;for(const o of this.parts){if(typeof o=="string"){n+=o;continue}const i=this.expandPart(o,t);i&&((o.operator==="?"||o.operator==="&")&&r?n+=i.replace("?","&"):n+=i,(o.operator==="?"||o.operator==="&")&&(r=!0))}return n}escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(t){const n=[];for(const i of t.names)Si.validateLength(i,Xw,"Variable name");if(t.operator==="?"||t.operator==="&"){for(let i=0;i128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!p3.test(e)){const n=e.split("").filter(r=>!/[A-Za-z0-9._-]/.test(r)).filter((r,o,i)=>i.indexOf(r)===o);return t.push(`Tool name contains invalid characters: ${n.map(r=>`"${r}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function m3(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(const n of t)console.warn(` - ${n}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function BC(e){const t=f3(e);return m3(e,t.warnings),t.isValid}class h3{constructor(t){this._mcpServer=t}registerToolTask(t,n,r){const o={taskSupport:"required",...n.execution};if(o.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,n.title,n.description,n.inputSchema,n.outputSchema,n.annotations,o,n._meta,r)}}class mt{constructor(t,n){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new c3(t,n)}get experimental(){return this._experimental||(this._experimental={tasks:new h3(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Ti(Np)),this.server.assertCanSetRequestHandler(Ti(xc)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Np,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,n])=>{const r={name:t,title:n.title,description:n.description,inputSchema:(()=>{const o=_c(n.inputSchema);return o?ux(o,{strictUnions:!0,pipeStrategy:"input"}):g3})(),annotations:n.annotations,execution:n.execution,_meta:n._meta};if(n.outputSchema){const o=_c(n.outputSchema);o&&(r.outputSchema=ux(o,{strictUnions:!0,pipeStrategy:"output"}))}return r})})),this.server.setRequestHandler(xc,async(t,n)=>{var r;try{const o=this._registeredTools[t.params.name];if(!o)throw new he(_e.InvalidParams,`Tool ${t.params.name} not found`);if(!o.enabled)throw new he(_e.InvalidParams,`Tool ${t.params.name} disabled`);const i=!!t.params.task,s=(r=o.execution)==null?void 0:r.taskSupport,a="createTask"in o.handler;if((s==="required"||s==="optional")&&!a)throw new he(_e.InternalError,`Tool ${t.params.name} has taskSupport '${s}' but was not registered with registerToolTask`);if(s==="required"&&!i)throw new he(_e.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(s==="optional"&&!i&&a)return await this.handleAutomaticTaskPolling(o,t,n);const l=await this.validateToolInput(o,t.params.arguments,t.params.name),c=await this.executeToolHandler(o,l,n);return i||await this.validateToolOutput(o,c,t.params.name),c}catch(o){if(o instanceof he&&o.code===_e.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,n,r){if(!t.inputSchema)return;const i=_c(t.inputSchema)??t.inputSchema,s=await vy(i,n);if(!s.success){const a="error"in s?s.error:"Unknown error",l=_y(a);throw new he(_e.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${l}`)}return s.data}async validateToolOutput(t,n,r){if(!t.outputSchema||!("content"in n)||n.isError)return;if(!n.structuredContent)throw new he(_e.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);const o=_c(t.outputSchema),i=await vy(o,n.structuredContent);if(!i.success){const s="error"in i?i.error:"Unknown error",a=_y(s);throw new he(_e.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${a}`)}}async executeToolHandler(t,n,r){const o=t.handler;if("createTask"in o){if(!r.taskStore)throw new Error("No task store provided.");const s={...r,taskStore:r.taskStore};if(t.inputSchema){const a=o;return await Promise.resolve(a.createTask(n,s))}else{const a=o;return await Promise.resolve(a.createTask(s))}}if(t.inputSchema){const s=o;return await Promise.resolve(s(n,r))}else{const s=o;return await Promise.resolve(s(r))}}async handleAutomaticTaskPolling(t,n,r){if(!r.taskStore)throw new Error("No task store provided for task-capable tool.");const o=await this.validateToolInput(t,n.params.arguments,n.params.name),i=t.handler,s={...r,taskStore:r.taskStore},a=o?await Promise.resolve(i.createTask(o,s)):await Promise.resolve(i.createTask(s)),l=a.task.taskId;let c=a.task;const u=c.pollInterval??5e3;for(;c.status!=="completed"&&c.status!=="failed"&&c.status!=="cancelled";){await new Promise(p=>setTimeout(p,u));const d=await r.taskStore.getTask(l);if(!d)throw new he(_e.InternalError,`Task ${l} not found during polling`);c=d}return await r.taskStore.getTaskResult(l)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Ti(Dp)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Dp,async t=>{switch(t.params.ref.type){case"ref/prompt":return Vk(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return Kk(t),this.handleResourceCompletion(t,t.params.ref);default:throw new he(_e.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,n){const r=this._registeredPrompts[n.name];if(!r)throw new he(_e.InvalidParams,`Prompt ${n.name} not found`);if(!r.enabled)throw new he(_e.InvalidParams,`Prompt ${n.name} disabled`);if(!r.argsSchema)return Hc;const o=vc(r.argsSchema),i=o==null?void 0:o[t.params.argument.name];if(!jC(i))return Hc;const s=u3(i);if(!s)return Hc;const a=await s(t.params.argument.value,t.params.context);return qC(a)}async handleResourceCompletion(t,n){const r=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===n.uri);if(!r){if(this._registeredResources[n.uri])return Hc;throw new he(_e.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}const o=r.resourceTemplate.completeCallback(t.params.argument.name);if(!o)return Hc;const i=await o(t.params.argument.value,t.params.context);return qC(i)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Ti(Tp)),this.server.assertCanSetRequestHandler(Ti(kp)),this.server.assertCanSetRequestHandler(Ti(Cp)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Tp,async(t,n)=>{const r=Object.entries(this._registeredResources).filter(([i,s])=>s.enabled).map(([i,s])=>({uri:i,name:s.name,...s.metadata})),o=[];for(const i of Object.values(this._registeredResourceTemplates)){if(!i.resourceTemplate.listCallback)continue;const s=await i.resourceTemplate.listCallback(n);for(const a of s.resources)o.push({...i.metadata,...a})}return{resources:[...r,...o]}}),this.server.setRequestHandler(kp,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([n,r])=>({name:n,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(Cp,async(t,n)=>{const r=new URL(t.params.uri),o=this._registeredResources[r.toString()];if(o){if(!o.enabled)throw new he(_e.InvalidParams,`Resource ${r} disabled`);return o.readCallback(r,n)}for(const i of Object.values(this._registeredResourceTemplates)){const s=i.resourceTemplate.uriTemplate.match(r.toString());if(s)return i.readCallback(r,s,n)}throw new he(_e.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Ti(Ip)),this.server.assertCanSetRequestHandler(Ti(Pp)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Ip,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,n])=>({name:t,title:n.title,description:n.description,arguments:n.argsSchema?w3(n.argsSchema):void 0}))})),this.server.setRequestHandler(Pp,async(t,n)=>{const r=this._registeredPrompts[t.params.name];if(!r)throw new he(_e.InvalidParams,`Prompt ${t.params.name} not found`);if(!r.enabled)throw new he(_e.InvalidParams,`Prompt ${t.params.name} disabled`);if(r.argsSchema){const o=_c(r.argsSchema),i=await vy(o,t.params.arguments);if(!i.success){const l="error"in i?i.error:"Unknown error",c=_y(l);throw new he(_e.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${c}`)}const s=i.data,a=r.callback;return await Promise.resolve(a(s,n))}else{const o=r.callback;return await Promise.resolve(o(n))}}),this._promptHandlersInitialized=!0)}resource(t,n,...r){let o;typeof r[0]=="object"&&(o=r.shift());const i=r[0];if(typeof n=="string"){if(this._registeredResources[n])throw new Error(`Resource ${n} is already registered`);const s=this._createRegisteredResource(t,void 0,n,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);const s=this._createRegisteredResourceTemplate(t,void 0,n,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(t,n,r,o){if(typeof n=="string"){if(this._registeredResources[n])throw new Error(`Resource ${n} is already registered`);const i=this._createRegisteredResource(t,r.title,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);const i=this._createRegisteredResourceTemplate(t,r.title,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(t,n,r,o,i){const s={name:t,title:n,metadata:o,readCallback:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==r&&(delete this._registeredResources[r],a.uri&&(this._registeredResources[a.uri]=s)),typeof a.name<"u"&&(s.name=a.name),typeof a.title<"u"&&(s.title=a.title),typeof a.metadata<"u"&&(s.metadata=a.metadata),typeof a.callback<"u"&&(s.readCallback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(t,n,r,o,i){const s={resourceTemplate:r,title:n,metadata:o,readCallback:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:c=>{typeof c.name<"u"&&c.name!==t&&(delete this._registeredResourceTemplates[t],c.name&&(this._registeredResourceTemplates[c.name]=s)),typeof c.title<"u"&&(s.title=c.title),typeof c.template<"u"&&(s.resourceTemplate=c.template),typeof c.metadata<"u"&&(s.metadata=c.metadata),typeof c.callback<"u"&&(s.readCallback=c.callback),typeof c.enabled<"u"&&(s.enabled=c.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=s;const a=r.uriTemplate.variableNames;return Array.isArray(a)&&a.some(c=>!!r.completeCallback(c))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(t,n,r,o,i){const s={title:n,description:r,argsSchema:o===void 0?void 0:da(o),callback:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==t&&(delete this._registeredPrompts[t],a.name&&(this._registeredPrompts[a.name]=s)),typeof a.title<"u"&&(s.title=a.title),typeof a.description<"u"&&(s.description=a.description),typeof a.argsSchema<"u"&&(s.argsSchema=da(a.argsSchema)),typeof a.callback<"u"&&(s.callback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[t]=s,o&&Object.values(o).some(l=>{var u;const c=l instanceof jo?(u=l._def)==null?void 0:u.innerType:l;return jC(c)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(t,n,r,o,i,s,a,l,c){BC(t);const u={title:n,description:r,inputSchema:HC(o),outputSchema:HC(i),annotations:s,execution:a,_meta:l,handler:c,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==t&&(typeof d.name=="string"&&BC(d.name),delete this._registeredTools[t],d.name&&(this._registeredTools[d.name]=u)),typeof d.title<"u"&&(u.title=d.title),typeof d.description<"u"&&(u.description=d.description),typeof d.paramsSchema<"u"&&(u.inputSchema=da(d.paramsSchema)),typeof d.outputSchema<"u"&&(u.outputSchema=da(d.outputSchema)),typeof d.callback<"u"&&(u.handler=d.callback),typeof d.annotations<"u"&&(u.annotations=d.annotations),typeof d._meta<"u"&&(u._meta=d._meta),typeof d.enabled<"u"&&(u.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(t,...n){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let r,o,i,s;if(typeof n[0]=="string"&&(r=n.shift()),n.length>1){const l=n[0];Qw(l)?(o=n.shift(),n.length>1&&typeof n[0]=="object"&&n[0]!==null&&!Qw(n[0])&&(s=n.shift())):typeof l=="object"&&l!==null&&(s=n.shift())}const a=n[0];return this._createRegisteredTool(t,void 0,r,o,i,s,{taskSupport:"forbidden"},void 0,a)}registerTool(t,n,r){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);const{title:o,description:i,inputSchema:s,outputSchema:a,annotations:l,_meta:c}=n;return this._createRegisteredTool(t,o,i,s,a,l,{taskSupport:"forbidden"},c,r)}prompt(t,...n){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let r;typeof n[0]=="string"&&(r=n.shift());let o;n.length>1&&(o=n.shift());const i=n[0],s=this._createRegisteredPrompt(t,void 0,r,o,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(t,n,r){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);const{title:o,description:i,argsSchema:s}=n,a=this._createRegisteredPrompt(t,o,i,s,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,n){return this.server.sendLoggingMessage(t,n)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}class Xr{constructor(t,n){this._callbacks=n,this._uriTemplate=typeof t=="string"?new Si(t):t}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(t){var n;return(n=this._callbacks.complete)==null?void 0:n[t]}}const g3={type:"object",properties:{}};function GC(e){return e!==null&&typeof e=="object"&&"parse"in e&&typeof e.parse=="function"&&"safeParse"in e&&typeof e.safeParse=="function"}function y3(e){return"_def"in e||"_zod"in e||GC(e)}function Qw(e){return typeof e!="object"||e===null||y3(e)?!1:Object.keys(e).length===0?!0:Object.values(e).some(GC)}function HC(e){if(e)return Qw(e)?da(e):e}function w3(e){const t=vc(e);return t?Object.entries(t).map(([n,r])=>{const o=LW(r),i=MW(r);return{name:n,description:o,required:!i}}):[]}function Ti(e){const t=vc(e),n=t==null?void 0:t.method;if(!n)throw new Error("Schema is missing a method literal");const r=dT(n);if(typeof r=="string")return r;throw new Error("Schema method literal must be a string")}function qC(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}const Hc={completion:{values:[],hasMore:!1}};typeof window<"u"&&(window.ModelContextProtocolSDK={server:{McpServer:mt},types:ex}),typeof globalThis<"u"&&(globalThis.ModelContextProtocolSDK={server:{McpServer:mt},types:ex});var ce=(e=>(e.ANGIE_ROUTE_NAVIGATION="angie-route-navigation",e.ANGIE_CHAT_TOGGLE="angie-chat-toggle",e.ANGIE_STUDIO_TOGGLE="angie-studio-toggle",e.ANGIE_SIDEBAR_TOGGLED="angie-sidebar-toggled",e.TOGGLE_ANGIE_SIDEBAR="toggleAngieSidebar",e.ANGIE_SIDEBAR_RESIZED="angie-sidebar-resized",e.STUDIO_UI_SESSION_START="studio-ui-session-start",e.STUDIO_UI_STATE_UPDATE="studio-ui-state-update",e.STUDIO_UI_SESSION_END="studio-ui-session-end",e.GET_SITE_KEY="get-site-key",e.ANGIE_ELEMENT_UPDATE_CUSTOM_CSS="angie/element/update-custom-css",e.ANGIE_ELEMENT_GET_HTML_MARKUP="angie/element/get-html-markup",e.ANGIE_ELEMENT_INJECT_CSS="angie/element/inject-css",e.ANGIE_ELEMENT_REMOVE_CSS="angie/element/remove-css",e.ANGIE_ELEMENT_GET_CSS="angie/element/get-css",e.ANGIE_MEDIA_UPLOAD="angie/media/upload",e.ANGIE_SETTINGS_UPDATE="angie/settings/update",e.ANGIE_CONTEXT_GET_WEBSITE_CONTEXT="angie/context/get-website-context",e.ANGIE_CONTEXT_GET_ANALYTICS_CONTEXT="angie/context/get-analytics-context",e.ANGIE_CONTEXT_GET_POST_ID="angie/context/get-post-id",e.ANGIE_ELEMENT_UPDATE_SETTINGS="angie/element/update-settings",e.ANGIE_GET_MEDIA_BLOB="angie/get-media-blob",e.ANGIE_GET_FETCHED_IMAGE_BLOB="angie/get-fetched-image-blob",e.ANGIE_GET_ARTIFACT="angie/get-artifact",e.ANGIE_GET_ARTIFACT_VERSION_COUNT="angie/get-artifact-version-count",e.ANGIE_WP_UPDATE_POST_FEATURED_IMAGE="angie/wp/update-post-featured-image",e.ANGIE_ELEMENT_GET_ELEMENT_ATTRIBUTES="angie/element/get-element-attributes",e.ANGIE_GET_GATE_VALUE="angie/get-gate-value",e.ANGIE_GUTENBERG_UPDATE_BLOCK="angie/gutenberg/update-block",e.ANGIE_MINIAPP_START="angie/miniapp/start",e.ANGIE_ZOOM_DISPLAY="angie/zoom/display",e.ANGIE_MODAL_DISPLAY="angie/modal/display",e.ANGIE_BRAND_VOICE_MODAL="angie/brand-voice/modal",e.ANGIE_IMAGE_PREVIEW_TOGGLE="angie/image/preview-toggle",e.ANGIE_IMAGE_PREVIEW_CLEANUP="angie/image/preview-cleanup",e.ANGIE_DELETE_CHAT_DIALOG="angie/delete-chat/dialog",e.ANGIE_IMAGE_SAVE_TO_GALLERY="angie/image/save-to-gallery",e.INIT_CONTEXT_SERVER="init-context-server",e.ANGIE_NAVIGATE_TO_URL="angie/navigate-to-url",e.ANGIE_PAGE_RELOAD="angie/page-reload",e.ANGIE_NAVIGATE_AFTER_RESPONSE="angie/navigate-after-response",e.ANGIE_CLIPBOARD_WRITE="angie/clipboard/write",e.REFERRER_INFO="referrer/info",e.QUERY_WP_DB="query-wp-db",e.GET_EXTERNAL_HEADERS="GET_EXTERNAL_HEADERS",e.SDK_ANGIE_READY_PING="sdk-angie-ready-ping",e.SDK_ANGIE_REFRESH_PING="sdk-angie-refresh-ping",e.SDK_ANGIE_ALL_SERVERS_REGISTERED="sdk-angie-all-servers-registered",e.SDK_REQUEST_CLIENT_CREATION="sdk-request-client-creation",e.SDK_REQUEST_INIT_SERVER="sdk-request-init-server",e.SDK_TRIGGER_ANGIE="sdk-trigger-angie",e.SDK_TRIGGER_ANGIE_RESPONSE="sdk-trigger-angie-response",e.ANGIE_PROCESSING_STATE_CHANGE="angie-processing-state-change",e.ANGIE_INTEGRATION_TRACK="angie/integration/track",e.ANGIE_BRAZE_EVENT="angie/braze-event",e.ANGIE_TEST_MODE_GET_STATUS="angie/test-mode/get-status",e.ANGIE_TEST_MODE_SET="angie/test-mode/set",e.ANGIE_TEST_MODE_CHANGED="angie/test-mode/changed",e.ANGIE_LIBRARY_MODAL_OPEN="angie/library/modal-open",e.ANGIE_CLOUD_LIBRARY_TOGGLE="angie/cloud-library/toggle",e.ANGIE_CLOUD_LIBRARY_SNIPPET_REQUEST="angie/cloud-library/snippet-request",e.ANGIE_CLOUD_LIBRARY_READY="angie-cloud-library/ready",e.ANGIE_CLOUD_LIBRARY_CLOSE="angie-cloud-library/close",e.ANGIE_COMMUNITY_LIBRARY_TOGGLE="angie/community-library/toggle",e.ANGIE_COMMUNITY_LIBRARY_READY="angie-community-library/ready",e.ANGIE_COMMUNITY_LIBRARY_CLOSE="angie-community-library/close",e.ANGIE_PROMPT_LIBRARY_MODAL="angie/prompt-library/modal",e.ANGIE_REMOTE_SEND_PROMPT_TO_ANGIE="send-prompt-to-angie",e.ANGIE_RECEIVED_PROMPT_FROM_LIBRARY="angie/received-prompt-from-library",e.ANGIE_PROMPT_LIBRARY_EXTERNAL_LINK_CLICKED="angie/prompt-library/external-link-clicked",e.SDK_WIDGET_CONFIG="sdk-widget-config",e.ANGIE_SUPER_ADMIN_OPT_IN="angie/super-admin/opt-in",e.ANGIE_ARTIFACT_SYNC_FILES="angie/artifact/sync-files",e.ANGIE_ARTIFACT_UPDATE_WP_FILES="angie/artifact/update-wp-files",e.ANGIE_ARTIFACT_GET_CLOUD_LIBRARY="angie/artifact/get-cloud-library",e.ANGIE_ARTIFACT_SET_CLOUD_LIBRARY="angie/artifact/set-cloud-library",e.ANGIE_CREATE_ARTIFACT_FROM_SNIPPET="angie/artifact/create-from-snippet",e))(ce||{});function v3(){const e=document.createElement("div");e.id="angie-zoom-overlay",e.tabIndex=0,e.style.cssText=` position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.9); display: flex; align-items: center; justify-content: center; z-index: 1000000; backdrop-filter: blur(5px); outline: none; `;const t=document.createElement("button");t.innerHTML="×",t.style.cssText=` position: absolute; top: 20px; right: 20px; background: rgba(255, 255, 255, 0.9); border: none; border-radius: 50%; width: 40px; height: 40px; font-size: 24px; cursor: pointer; z-index: 1000001; display: flex; align-items: center; justify-content: center; color: #333; font-weight: bold; transition: all 0.2s; `,t.addEventListener("mouseenter",()=>{t.style.backgroundColor="rgba(255, 255, 255, 1)",t.style.transform="scale(1.1)"}),t.addEventListener("mouseleave",()=>{t.style.backgroundColor="rgba(255, 255, 255, 0.9)",t.style.transform="scale(1)"});const n=document.createElement("div");n.style.cssText=` position: relative; max-width: 90vw; max-height: 90vh; display: flex; align-items: center; justify-content: center; `;const r=document.createElement("div");r.style.cssText=` position: relative; display: flex; align-items: center; justify-content: center; `;const o=document.createElement("img");return o.style.cssText=` max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); `,{overlay:e,closeButton:t,contentContainer:n,imageContainer:r,img:o}}function _3(e,t,n,r){if(r<=1)return{prevButton:null,nextButton:null};const o=document.createElement("button");o.innerHTML="‹",o.style.cssText=` position: absolute; left: -60px; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, 0.9); border: none; border-radius: 50%; width: 50px; height: 50px; font-size: 24px; cursor: pointer; z-index: 1000001; display: flex; align-items: center; justify-content: center; color: #333; font-weight: bold; transition: all 0.2s; `,o.addEventListener("mouseenter",()=>{o.style.backgroundColor="rgba(255, 255, 255, 1)",o.style.transform="translateY(-50%) scale(1.05)"}),o.addEventListener("mouseleave",()=>{o.style.backgroundColor="rgba(255, 255, 255, 0.9)",o.style.transform="translateY(-50%) scale(1)"}),o.onclick=s=>{s.stopPropagation(),t()};const i=document.createElement("button");return i.innerHTML="›",i.style.cssText=` position: absolute; right: -60px; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, 0.9); border: none; border-radius: 50%; width: 50px; height: 50px; font-size: 24px; cursor: pointer; z-index: 1000001; display: flex; align-items: center; justify-content: center; color: #333; font-weight: bold; transition: all 0.2s; `,i.addEventListener("mouseenter",()=>{i.style.backgroundColor="rgba(255, 255, 255, 1)",i.style.transform="translateY(-50%) scale(1.05)"}),i.addEventListener("mouseleave",()=>{i.style.backgroundColor="rgba(255, 255, 255, 0.9)",i.style.transform="translateY(-50%) scale(1)"}),i.onclick=s=>{s.stopPropagation(),n()},e.appendChild(o),e.appendChild(i),{prevButton:o,nextButton:i}}function b3(e,t){if(t<=1)return null;const n=document.createElement("div");return n.style.cssText=` position: absolute; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.7); color: white; padding: 8px 16px; border-radius: 20px; font-size: 14px; font-weight: 500; z-index: 1000001; `,e.appendChild(n),n}function E3(e,t,n){if(t.length<=1)return null;const r=document.createElement("div");r.style.cssText=` position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; padding: 12px; background: rgba(0, 0, 0, 0.5); border-radius: 8px; max-width: 90vw; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; `;const o=document.createElement("style");return o.textContent=` #angie-zoom-overlay .thumbnail-container::-webkit-scrollbar { display: none; } `,document.head.appendChild(o),r.className="thumbnail-container",t.forEach((i,s)=>{const a=document.createElement("img");a.src=i.image_url,a.className="thumbnail",a.style.cssText=` width: 60px; height: 60px; object-fit: cover; border-radius: 4px; cursor: pointer; transition: all 0.2s; border: 2px solid rgba(255, 255, 255, 0.3); opacity: 0.7; `,a.addEventListener("mouseenter",()=>{s!==VC()&&(a.style.opacity="0.9",a.style.transform="scale(1.05)")}),a.addEventListener("mouseleave",()=>{s!==VC()&&(a.style.opacity="0.7",a.style.transform="scale(1)")}),a.onclick=l=>{l.stopPropagation(),n(s)},r.appendChild(a)}),e.appendChild(r),r}let or=0;function VC(){return or}function S3(e,t){const{images:n}=e,{img:r,counterElement:o,prevButton:i,nextButton:s,thumbnailContainer:a}=t,l=n.length>1;or=Math.max(0,Math.min(e.initialIndex||0,n.length-1));const c=()=>{const m=n[or];r.src=m.image_url,r.alt=`Image ${or+1}`,l&&o&&(o.textContent=`${or+1} of ${n.length}`),i&&(i.style.opacity="1",i.style.cursor="pointer"),s&&(s.style.opacity="1",s.style.cursor="pointer"),l&&a&&a.querySelectorAll(".thumbnail").forEach((w,v)=>{v===or?(w.style.border="3px solid #EB8EFB",w.style.opacity="1"):(w.style.border="2px solid rgba(255, 255, 255, 0.3)",w.style.opacity="0.7")})};return{updateImage:c,goToPrevious:()=>{or=or===0?n.length-1:or-1,c()},goToNext:()=>{or=or===n.length-1?0:or+1,c()},goToIndex:m=>{m>=0&&m{r.remove(),document.removeEventListener("keydown",l),document.head.querySelectorAll("style").forEach(u=>{var d;(d=u.textContent)!=null&&d.includes("thumbnail-container::-webkit-scrollbar")&&u.remove()})},l=c=>{switch(c.key){case"Escape":a();break;case"ArrowLeft":n&&(c.preventDefault(),t.goToPrevious());break;case"ArrowRight":n&&(c.preventDefault(),t.goToNext());break}};o.onclick=c=>{c.stopPropagation(),a()},r.onclick=a,i.onclick=c=>{c.stopPropagation()},s.onclick=c=>{c.stopPropagation()},document.addEventListener("keydown",l)}const k3=e=>{if(!e.images||e.images.length===0){console.warn("No images provided to showZoomOverlay");return}const t=document.getElementById("angie-zoom-overlay");t&&t.remove();const n=v3(),r=S3(e,n),{updateImage:o,goToPrevious:i,goToNext:s,goToIndex:a,isGalleryMode:l}=r,c=_3(n.imageContainer,i,s,e.images.length);b3(n.overlay,e.images.length),E3(n.overlay,e.images,a);const u={...n,prevButton:c.prevButton||void 0,nextButton:c.nextButton||void 0};T3(u,{goToPrevious:i,goToNext:s},l),u.imageContainer.appendChild(u.img),u.contentContainer.appendChild(u.imageContainer),u.overlay.appendChild(u.closeButton),u.overlay.appendChild(u.contentContainer),document.body.appendChild(u.overlay),o(),u.overlay.focus(),console.log("Zoom overlay displayed:",l?`gallery with ${e.images.length} images`:"single image")};let qc=null;async function x3(){if(qc)return qc;qc=C3();try{return await qc}finally{qc=null}}async function C3(){const e=new URL(window.ajaxurl||"/wp-admin/admin-ajax.php",window.location.origin);e.searchParams.set("action","rest-nonce");const t=await fetch(e.toString(),{credentials:"same-origin"});if(!t.ok)throw new Error(`Failed to refresh nonce: HTTP ${t.status}`);const n=await t.text();if(!n||n==="0")throw new Error("Session expired — received invalid nonce");if(!window.wpApiSettings)throw new Error("wpApiSettings not available — cannot refresh nonce");return window.wpApiSettings.nonce=n,n}function I3(e,t){return e===403&&t.includes("rest_cookie_invalid_nonce")}async function B(e,t,n,r){return KC(e,t,n,r,!0)}async function KC(e,t,n,r,o=!1){var d,p;if(!((d=window.wpApiSettings)!=null&&d.nonce)||!window.wpApiSettings.root)throw new Error("wpApiSettings not available");const i=window.wpApiSettings.root,s=new URL(i),a=new URL(e,i);s.searchParams.set("rest_route",a.pathname);for(const[m,h]of a.searchParams.entries())s.searchParams.append(m,h);const l=s.toString(),c={"X-WP-Nonce":window.wpApiSettings.nonce,...(r==null?void 0:r.customHeaders)||{}};!(r!=null&&r.binaryData)&&!((p=r==null?void 0:r.customHeaders)!=null&&p["Content-Type"])&&(c["Content-Type"]="application/json");const u={method:t,headers:c,credentials:"same-origin"};r!=null&&r.binaryData?u.body=r.binaryData:n&&(t==="POST"||t==="PUT"||t==="PATCH")&&(u.body=JSON.stringify(n));try{console.log("Fetching WP API call: ",l,u);const m=await fetch(l,u);if(!m.ok){const _=await m.text();if(o&&I3(m.status,_))return console.warn("WP nonce expired, refreshing and retrying..."),await x3(),KC(e,t,n,r,!1);throw new Error(`HTTP error ${m.status}: ${_}`)}const h=await m.text(),w=P3(h);if(w===null)throw new Error(`Invalid response: no JSON found in: ${h.substring(0,200)}`);if((w==null?void 0:w.success)!==void 0&&!w.success)throw new Error(`API errors: ${JSON.stringify(w)}`);console.log("JSON extracted from WordPress response:",w);const v=m.headers.get("X-WP-Total"),f=m.headers.get("X-WP-TotalPages"),g=v?parseInt(v,10):void 0,y=f?parseInt(f,10):void 0;return{data:w,totalItems:g,totalPages:y}}catch(m){throw console.error("WordPress API call failed:",m),m}}function P3(e){const t=e.indexOf("{"),n=e.indexOf("[");let r=-1,o=!1;if(t===-1&&n===-1)return null;t===-1?(r=n,o=!0):n===-1?(r=t,o=!1):n{e.postMessage({status:"success",payload:t})},je=(e,t)=>{e.postMessage({status:"error",payload:t})};let In={},Pn={};async function nv(){try{console.log("[WordPress Server] Fetching post types..."),In=(await B("/wp/v2/types","GET")).data,console.log("[WordPress Server] Post types loaded:",Object.keys(In))}catch(e){console.error("[WordPress Server] Failed to fetch post types:",e),In={post:{name:"Posts",slug:"post",rest_base:"posts",hierarchical:!1,has_archive:!1,taxonomies:[]},page:{name:"Pages",slug:"page",rest_base:"pages",hierarchical:!0,has_archive:!1,taxonomies:[]}}}}async function ki(e,t=!1){let n=In[e];if(n||(console.log(`[WordPress Server] Unknown post type: ${e}. Refreshing post types cache...`),await nv(),n=In[e]),!n)throw new Error(`Unknown post type: ${e}. Available types: ${Object.keys(In).join(", ")}`);return t&&!n.metaSchema&&(n.metaSchema=await JC(e)),`/wp/v2/${n.rest_base}`}async function Ra(){try{console.log("[WordPress Server] Fetching taxonomies..."),Pn=(await B("/wp/v2/taxonomies","GET")).data,console.log("[WordPress Server] Taxonomies loaded:",Object.keys(Pn))}catch(e){console.error("[WordPress Server] Failed to fetch taxonomies:",e),Pn={category:{name:"Categories",slug:"category",description:"",rest_base:"categories",hierarchical:!0,public:!0,show_in_rest:!0,types:["post"]},post_tag:{name:"Tags",slug:"post_tag",description:"",rest_base:"tags",hierarchical:!1,public:!0,show_in_rest:!0,types:["post"]}}}return Pn}async function YC(e){let t=Pn[e];if(t||(console.log(`[WordPress Server] Unknown taxonomy: ${e}. Refreshing taxonomies cache...`),await Ra(),t=Pn[e]),!t)throw new Error(`Unknown taxonomy: ${e}. Available taxonomies: ${Object.keys(Pn).join(", ")}`);return t.rest_base}async function _s(e){return`/wp/v2/${await YC(e)}`}async function j3(e){var a,l,c,u,d,p;const t=Pn[e];console.log(`[WordPress Server] Fetching meta fields for taxonomy: ${e}`);const r=(await B(`/wp/v2/${t.rest_base}`,"OPTIONS")).data,o=(c=(l=(a=r.schema)==null?void 0:a.properties)==null?void 0:l.meta)==null?void 0:c.properties,i=(p=(d=(u=r.schema)==null?void 0:u.properties)==null?void 0:d.acf)==null?void 0:p.properties,s={meta:o&&typeof o=="object"&&!Array.isArray(o)?o:{},acf:i&&typeof i=="object"&&!Array.isArray(i)?i:{}};return console.log("[WordPress Server] Taxonomy meta fields:",s),s}async function W3(e){let t=Pn[e];if(t||(console.log(`[WordPress Server] Unknown taxonomy: ${e}. Refreshing taxonomies cache...`),await Ra(),t=Pn[e]),!t)throw new Error(`Unknown taxonomy: ${e}. Available taxonomies: ${Object.keys(Pn).join(", ")}`);return t.metaSchema||(t.metaSchema=await j3(e)),t.metaSchema}async function F3(e){var i,s,a,l,c,u;const t=In[e];console.log("[WordPress Server] Fetching meta fields for post type:",e);const r=(await B(`/wp/v2/${t.rest_base}`,"OPTIONS")).data,o={meta:((a=(s=(i=r.schema)==null?void 0:i.properties)==null?void 0:s.meta)==null?void 0:a.properties)||{},acf:((u=(c=(l=r.schema)==null?void 0:l.properties)==null?void 0:c.acf)==null?void 0:u.properties)||{}};return console.log("[WordPress Server] Post type meta fields:",o),o}async function JC(e){const t=In[e];if(!t)throw new Error(`Unknown post type: ${e}. Available types: ${Object.keys(In).join(", ")}`);return t.metaSchema||(t.metaSchema=await F3(e)),t.metaSchema}function rv(){return new URL(window.wpApiSettings.root).origin}function ir(e,t){const n=new URL(e,"http://localhost");return Object.entries(t).forEach(([r,o])=>{o!=null&&(Array.isArray(o)?n.searchParams.set(r,o.join(",")):n.searchParams.set(r,String(o)))}),n.pathname+n.search}const z3=async(e,t,n)=>{try{const r=new CustomEvent(e,n?{detail:n}:void 0);window.dispatchEvent(r),Ye(t,{message:`${e} event dispatched successfully`})}catch(r){console.error(`Error dispatching ${e} event:`,r),je(t,{message:`Error dispatching ${e} event: ${r}`})}};async function B3(e,t){const r=(await t("/wp/v2/plugins","GET")).data;if(e.includes("/")){if(r.find(i=>i.plugin===e))return e;throw new Error(`Plugin basename "${e}" not found. Use the "list" action first to get the correct basename from installed plugins.`)}if(Array.isArray(r)){for(const o of r)if(o.plugin&&o.plugin.startsWith(`${e}/`)||o.name&&o.name.toLowerCase().includes(e.toLowerCase()))return o.plugin}throw new Error(`Plugin "${e}" not found. Use the "list" action first to get available plugins and their exact basenames.`)}async function G3(e,t){if(t.length===0)return{valid:[],invalid:[]};try{const n=ir(await _s(e),{include:t,per_page:100,_fields:"id"}),i=(await B(n,"GET")).data.map(l=>l.id),s=t.filter(l=>i.includes(l)),a=t.filter(l=>!i.includes(l));return{valid:s,invalid:a}}catch(n){return console.error(`[WordPress Server] Error validating terms for taxonomy ${e}:`,n),{valid:[],invalid:t}}}function H3(e,t=!1){const{type:n,status:r,...o}=e,i={...o};return t&&r!==void 0&&(i.status=r),delete i.modified,delete i.modified_gmt,i}async function q3(){try{const t=(await B("/wp/v2/plugins/elementor/elementor","GET")).data;if((t==null?void 0:t.status)!=="active")throw new Error("Elementor plugin not active. Ask the user if he want to activate it.")}catch{throw new Error("Elementor plugin is not installed. Ask the user if he want to install and activate it.")}}function Go(){var e,t;return((t=(e=window.wp)==null?void 0:e.data)==null?void 0:t.select("core/editor"))!==void 0}function bs(){const e=new URLSearchParams(window.location.search);for(const[,t]of e.entries())if(t.includes("elementor"))return!0;return!1}function V3(){return!!document.querySelector(".edit-post-header-toolbar")}const XC=()=>{if(!window.elementorFrontend||!window.elementorFrontend.elements||!window.elementorFrontend.elements.$body)throw new Error("elementorFrontend or its required components not available")},ov=()=>!!window.$e.components.get("panel"),K3=()=>new Promise(e=>{if(ov()){e();return}if(!window.elementor)throw new Error("Elementor is not available");const t=()=>{ov()?e():setTimeout(t,100)};window.elementor.on("document:loaded",()=>{ov()?e():window.elementorFrontend.on("components:init",t)})}),QC=async({id:e,settings:t})=>{console.log("Updating element settings:",{id:e,settings:t});const n=window.elementor.getContainer(e);if(!n)throw new Error(`Element with ID "${e}" not found.`);const r=await window.$e.run("document/elements/settings",{container:n,settings:t,options:{external:!0,render:!0}});return window.elementorFrontend.elements.$body.resize(),r},Z3=e=>{const t=window.elementor.getContainer(e);if(!t)throw new Error(`Element with ID "${e}" not found.`);const{settings:n}=t;return n},Y3=()=>{if(!Go())throw new Error("WordPress editor API is not available");const e=window.wp.data.dispatch("core/block-editor"),t=window.wp.data.select("core/block-editor");if(!e||!t)throw new Error("Block editor API is not available");return{blockEditorDispatch:e,blockEditorSelect:t}},J3=(e,t)=>{const n=e.getBlock(t);if(!n)throw new Error(`Block with ID "${t}" not found`);return n},X3=(e,t)=>{const{blockEditorDispatch:n,blockEditorSelect:r}=Y3(),o=J3(r,e);return n.updateBlockAttributes(e,t),{blockId:e,blockName:o.name,updatedAttributes:Object.keys(t)}},eI=(e,t)=>{const n=e,r=document.createElement("style");r.id=n,r.appendChild(document.createTextNode(t)),XC(),window.elementorFrontend.elements.$body[0].appendChild(r)},tI=e=>{const t=e;XC();const n=window.elementorFrontend.elements.$body[0],r=n.querySelectorAll(`#${CSS.escape(t)}`);(r==null?void 0:r.length)>0&&r.forEach(o=>{n.removeChild(o)})},Q3=e=>!!(e.id&&e.id.includes("select-all")||e.name&&e.name.includes("select-all")),e9=(e,t="",n="")=>{var i,s,a;let r=t,o=n;if(e&&(!r||!o)){const l=(s=(i=window.elementor)==null?void 0:i.getContainer)==null?void 0:s.call(i,e);if(l){const c=l.settings.get("image");if(c&&typeof c=="object"){const u=c;r=r||((a=u.id)==null?void 0:a.toString())||"",o=o||u.url||""}}}return{imageId:r,imageUrl:o}},lf={context:{}},t9=async(e=!0)=>{var t,n,r,o,i;if(e&&Object.keys(lf.context).length)return lf.context;try{const s=((t=window.angieConfig)==null?void 0:t.plugins)||{};return lf.context={wpUsername:(n=window.angieConfig)==null?void 0:n.wpUsername,untrusted__wpUserRole:(r=window.angieConfig)==null?void 0:r.untrusted__wpUserRole,pluginVersion:(o=window.angieConfig)==null?void 0:o.version,siteKey:(i=window.angieConfig)==null?void 0:i.siteKey,screenPath:window.location.pathname,plugins:{elementor:!!s.elementor,elementorPro:!!s.elementorPro,woocommerce:!!s.woocommerce,acf:!!s.acf,classicEditor:!!s.classicEditor}},lf.context}catch(s){return console.error(s),{wpUsername:void 0,untrusted__wpUserRole:void 0,pluginVersion:void 0,siteKey:void 0,screenPath:void 0,plugins:void 0}}},n9=async(e,t)=>{var m,h;const{blob:n,filename:r,title:o="Generated Image",alt_text:i="Generated Image"}=t;console.log("Uploading image to media library:",{filename:r,title:o,altText:i});let s="application/octet-stream";const a=(m=r.split(".").pop())==null?void 0:m.toLowerCase();a&&(["jpg","jpeg"].includes(a)?s="image/jpeg":a==="png"?s="image/png":a==="gif"?s="image/gif":a==="svg"&&(s="image/svg+xml"));const l=n.includes("data:")?n.split(",")[1]:n,c=window.atob(l),u=new Uint8Array(c.length);for(let w=0;w{const r=o=>{window.removeEventListener("elementor:ai:modal-closed",r),console.log("🎉 AI Modal closed with result:",o.detail),o.detail.success?t(o.detail):n({...o.detail,action:"cancel"})};window.addEventListener("elementor:ai:modal-closed",r),console.log(`🚀 Triggering AI modal: ${e.modalType} → ${location}`),window.dispatchEvent(new CustomEvent("elementor:ai:show-modal",{detail:{...e,location:e.modalType}}))})}class o9{constructor(t){Ce(this,"sessionId");Ce(this,"onmessage");Ce(this,"onerror");Ce(this,"onclose");Ce(this,"_port");Ce(this,"_started",!1);Ce(this,"_closed",!1);if(!t)throw new Error("MessagePort is required");this._port=t,this._port.onmessage=n=>{var r,o;try{const i=$y.parse(n.data);(r=this.onmessage)==null||r.call(this,i)}catch(i){const s=new Error(`Failed to parse message: ${i}`);(o=this.onerror)==null||o.call(this,s)}},this._port.onmessageerror=n=>{var o;const r=new Error(`MessagePort error: ${JSON.stringify(n)}`);(o=this.onerror)==null||o.call(this,r)}}async start(){if(this._started)throw new Error("BrowserContextTransport already started! If using Client or Server class, note that connect() calls start() automatically.");if(this._closed)throw new Error("Cannot start a closed BrowserContextTransport");this._started=!0,this._port.start()}async send(t){if(this._closed)throw new Error("Cannot send on a closed BrowserContextTransport");return new Promise((n,r)=>{var o;try{this._port.postMessage(t),n()}catch(i){const s=i instanceof Error?i:new Error(String(i));(o=this.onerror)==null||o.call(this,s),r(s)}})}async close(){var t;this._closed||(this._closed=!0,this._port.close(),(t=this.onclose)==null||t.call(this))}}const nI={none:0,error:1,warn:2,info:3,debug:4},i9={error:"error",warn:"warn",info:"info",log:"info",debug:"debug"},s9=(e,t)=>nI[e]<=nI[t],iv=e=>typeof e=="string"?e:JSON.stringify(e),a9=(e,t)=>`${iv(e)} > ${iv(t)}`,l9=(e,t)=>{let n=`[${iv(e)}]`;return typeof window<"u"?{text:`%c${n}`,style:`color: ${t.color||"#00bcd4"}; font-weight: bold;`}:{text:n}},Vc=(e,t,n,r)=>(...o)=>{if(!s9(i9[e],r()))return;if(!t)return void console[e](...o);let{text:i,style:s}=l9(t,n);s?console[e](i,s,...o):console[e](i,...o)},rI=(e,t)=>{let n=t.logLevel??"debug",r=()=>n;return{log:Vc("log",e,t,r),info:Vc("info",e,t,r),warn:Vc("warn",e,t,r),error:Vc("error",e,t,r),debug:Vc("debug",e,t,r),setLogLevel:o=>{n=o},extend:o=>rI(e?a9(e,o):o,{...t,logLevel:n})}},sv=(e,t)=>rI(e,{color:"#00bcd4",logLevel:"debug",...t}),c9=sv("angie-sdk",{color:"#00BCD4",logLevel:"error"}),go=e=>c9.extend(e),av=go("iframe-utils");let cf=null;const zn=()=>(cf&&document.contains(cf)||(cf=document.querySelector('iframe[src*="angie/"]')),cf),Kc=(e,t)=>{av.log("postMessageToAngieIframe",e,t);const n=zn();if(!(n!=null&&n.contentWindow))return!1;const r=(()=>{const o=zn();if(!o)return null;try{return new URL(o.src).origin}catch(i){return av.error("Error parsing iframe URL:",i),null}})();return r?(n.contentWindow.postMessage(e,r),!0):(av.error("Could not determine target origin for Angie iframe"),!1)};var oI,uf,iI,Aa,ut,$a,Oa;(function(e){e.POST_MESSAGE="postMessage"})(oI||(oI={})),function(e){e.POST_MESSAGE="postMessage"}(uf||(uf={})),function(e){e.STREAMABLE_HTTP="streamableHttp",e.SSE="sse"}(iI||(iI={})),function(e){e.LOCAL="local",e.REMOTE="remote"}(Aa||(Aa={})),function(e){e.SDK_ANGIE_READY_PING="sdk-angie-ready-ping",e.SDK_ANGIE_REFRESH_PING="sdk-angie-refresh-ping",e.SDK_ANGIE_ALL_SERVERS_REGISTERED="sdk-angie-all-servers-registered",e.SDK_REQUEST_CLIENT_CREATION="sdk-request-client-creation",e.SDK_REQUEST_INIT_SERVER="sdk-request-init-server",e.SDK_TRIGGER_ANGIE="sdk-trigger-angie",e.SDK_TRIGGER_ANGIE_RESPONSE="sdk-trigger-angie-response",e.ANGIE_SIDEBAR_RESIZED="angie-sidebar-resized",e.ANGIE_SIDEBAR_TOGGLED="angie-sidebar-toggled",e.ANGIE_CHAT_TOGGLE="angie-chat-toggle",e.ANGIE_STUDIO_TOGGLE="angie-studio-toggle",e.ANGIE_NAVIGATE_TO_URL="angie/navigate-to-url",e.ANGIE_PAGE_RELOAD="angie/page-reload",e.ANGIE_DISABLE_NAVIGATION_PREVENTION="angie/disable-navigation-prevention",e.ANGIE_NAVIGATE_AFTER_RESPONSE="angie/navigate-after-response"}(ut||(ut={})),function(e){e.SET="ANGIE_SET_LOCALSTORAGE",e.GET="ANGIE_GET_LOCALSTORAGE"}($a||($a={})),function(e){e.RESET_HASH="reset-hash",e.HOST_READY="host/ready",e.ANGIE_LOADED="angie/loaded",e.ANGIE_READY="angie/ready"}(Oa||(Oa={}));const u9=go("angie-detector");let d9=class{constructor(){Ce(this,"isAngieReady",!1);Ce(this,"readyPromise");Ce(this,"readyResolve");if(this.readyPromise=new Promise(r=>{this.readyResolve=r}),typeof window>"u")return;let t=0;const n=()=>{if(this.isAngieReady||t>=500)return void(!this.isAngieReady&&t>=500&&this.handleDetectionTimeout());const r=new MessageChannel;r.port1.onmessage=i=>{this.handleAngieReady(i.data),r.port1.close(),r.port2.close()};const o={type:ut.SDK_ANGIE_READY_PING,timestamp:Date.now()};window.postMessage(o,window.location.origin,[r.port2]),t++,setTimeout(n,500)};n()}handleAngieReady(t){this.isAngieReady=!0;const n={isReady:!0,version:t.version,capabilities:t.capabilities};this.readyResolve&&this.readyResolve(n)}handleDetectionTimeout(){this.readyResolve&&this.readyResolve({isReady:!1}),u9.warn("Detection timeout - Angie may not be available")}isReady(){return this.isAngieReady}async waitForReady(){return this.readyPromise}},p9=class{constructor(t){Ce(this,"sessionId");Ce(this,"onmessage");Ce(this,"onerror");Ce(this,"onclose");Ce(this,"_port");Ce(this,"_started",!1);Ce(this,"_closed",!1);if(!t)throw new Error("MessagePort is required");this._port=t,this._port.onmessage=n=>{var r,o;try{const i=$y.parse(n.data);(r=this.onmessage)==null||r.call(this,i)}catch(i){const s=new Error(`Failed to parse message: ${i}`);(o=this.onerror)==null||o.call(this,s)}},this._port.onmessageerror=n=>{var o;const r=new Error(`MessagePort error: ${JSON.stringify(n)}`);(o=this.onerror)==null||o.call(this,r)}}async start(){if(this._started)throw new Error("BrowserContextTransport already started! If using Client or Server class, note that connect() calls start() automatically.");if(this._closed)throw new Error("Cannot start a closed BrowserContextTransport");this._started=!0,this._port.start()}async send(t){if(this._closed)throw new Error("Cannot send on a closed BrowserContextTransport");return new Promise((n,r)=>{var o;try{this._port.postMessage(t),n()}catch(i){const s=i instanceof Error?i:new Error(String(i));(o=this.onerror)==null||o.call(this,s),r(s)}})}async close(){var t;this._closed||(this._closed=!0,this._port.close(),(t=this.onclose)==null||t.call(this))}},f9=class{async requestClientCreation(t){const{config:n}=t,r={serverId:t.id,serverName:n.name,serverTitle:n.title,serverVersion:n.version,description:n.description,transport:n.transport||uf.POST_MESSAGE,capabilities:n.capabilities,instanceId:t.instanceId};return"type"in n&&n.type==="remote"&&(r.remote={url:n.url}),new Promise((o,i)=>{const s=new MessageChannel,a=setTimeout(()=>{i(new Error("Client creation request timed out after 15000ms"))},15e3);s.port1.onmessage=c=>{clearTimeout(a),o(c.data)};const l={type:ut.SDK_REQUEST_CLIENT_CREATION,payload:r,timestamp:Date.now()};window.postMessage(l,window.location.origin,[s.port2])})}};const sI="angie-sidebar-container",It={open:!1,iframe:null,iframeUrlObject:null,containerId:sI};let Zc=class extends Error{};Zc.prototype.name="InvalidTokenError";var yo,wo,lv,m9={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},Es=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(Es||{});(lv=Es||(Es={})).reset=function(){yo=3,wo=m9},lv.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");yo=e},lv.setLogger=function(e){wo=e};var ze=class Lo{constructor(t){this._name=t}debug(...t){yo>=4&&wo.debug(Lo._format(this._name,this._method),...t)}info(...t){yo>=3&&wo.info(Lo._format(this._name,this._method),...t)}warn(...t){yo>=2&&wo.warn(Lo._format(this._name,this._method),...t)}error(...t){yo>=1&&wo.error(Lo._format(this._name,this._method),...t)}throw(t){throw this.error(t),t}create(t){const n=Object.create(this);return n._method=t,n.debug("begin"),n}static createStatic(t,n){const r=new Lo(`${t}.${n}`);return r.debug("begin"),r}static _format(t,n){const r=`[${t}]`;return n?`${r} ${n}:`:r}static debug(t,...n){yo>=4&&wo.debug(Lo._format(t),...n)}static info(t,...n){yo>=3&&wo.info(Lo._format(t),...n)}static warn(t,...n){yo>=2&&wo.warn(Lo._format(t),...n)}static error(t,...n){yo>=1&&wo.error(Lo._format(t),...n)}};Es.reset();var Yc=class{static decode(t){try{return function(n,r){if(typeof n!="string")throw new Zc("Invalid token specified: must be a string");r||(r={});const o=r.header===!0?0:1,i=n.split(".")[o];if(typeof i!="string")throw new Zc(`Invalid token specified: missing part #${o+1}`);let s;try{s=function(a){let l=a.replace(/-/g,"+").replace(/_/g,"/");switch(l.length%4){case 0:break;case 2:l+="==";break;case 3:l+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(c){return decodeURIComponent(atob(c).replace(/(.)/g,(u,d)=>{let p=d.charCodeAt(0).toString(16).toUpperCase();return p.length<2&&(p="0"+p),"%"+p}))}(l)}catch{return atob(l)}}(i)}catch(a){throw new Zc(`Invalid token specified: invalid base64 for part #${o+1} (${a.message})`)}try{return JSON.parse(s)}catch(a){throw new Zc(`Invalid token specified: invalid json for part #${o+1} (${a.message})`)}}(t)}catch(n){throw ze.error("JwtUtils.decode",n),n}}static async generateSignedJwt(t,n,r){const o=`${zt.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t)))}.${zt.encodeBase64Url(new TextEncoder().encode(JSON.stringify(n)))}`,i=await window.crypto.subtle.sign({name:"ECDSA",hash:{name:"SHA-256"}},r,new TextEncoder().encode(o));return`${o}.${zt.encodeBase64Url(new Uint8Array(i))}`}static async generateSignedJwtWithHmac(t,n,r){const o=`${zt.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t)))}.${zt.encodeBase64Url(new TextEncoder().encode(JSON.stringify(n)))}`,i=await window.crypto.subtle.sign("HMAC",r,new TextEncoder().encode(o));return`${o}.${zt.encodeBase64Url(new Uint8Array(i))}`}},cv=e=>btoa([...new Uint8Array(e)].map(t=>String.fromCharCode(t)).join("")),aI=class lo{static _randomWord(){const t=new Uint32Array(1);return crypto.getRandomValues(t),t[0]}static generateUUIDv4(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^lo._randomWord()&15>>+n/4).toString(16)).replace(/-/g,"")}static generateCodeVerifier(){return lo.generateUUIDv4()+lo.generateUUIDv4()+lo.generateUUIDv4()}static async generateCodeChallenge(t){if(!crypto.subtle)throw new Error("Crypto.subtle is available only in secure contexts (HTTPS).");try{const n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n);return cv(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(n){throw ze.error("CryptoUtils.generateCodeChallenge",n),n}}static generateBasicAuth(t,n){const r=new TextEncoder().encode([t,n].join(":"));return cv(r)}static async hash(t,n){const r=new TextEncoder().encode(n),o=await crypto.subtle.digest(t,r);return new Uint8Array(o)}static async customCalculateJwkThumbprint(t){let n;switch(t.kty){case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"oct":n={crv:t.k,kty:t.kty};break;default:throw new Error("Unknown jwk type")}const r=await lo.hash("SHA-256",JSON.stringify(n));return lo.encodeBase64Url(r)}static async generateDPoPProof({url:t,accessToken:n,httpMethod:r,keyPair:o,nonce:i}){let s,a;const l={jti:window.crypto.randomUUID(),htm:r??"GET",htu:t,iat:Math.floor(Date.now()/1e3)};n&&(s=await lo.hash("SHA-256",n),a=lo.encodeBase64Url(s),l.ath=a),i&&(l.nonce=i);try{const c=await crypto.subtle.exportKey("jwk",o.publicKey),u={alg:"ES256",typ:"dpop+jwt",jwk:{crv:c.crv,kty:c.kty,x:c.x,y:c.y}};return await Yc.generateSignedJwt(u,l,o.privateKey)}catch(c){throw c instanceof TypeError?new Error(`Error exporting dpop public key: ${c.message}`):c}}static async generateDPoPJkt(t){try{const n=await crypto.subtle.exportKey("jwk",t.publicKey);return await lo.customCalculateJwkThumbprint(n)}catch(n){throw n instanceof TypeError?new Error(`Could not retrieve dpop keys from storage: ${n.message}`):n}}static async generateDPoPKeys(){return await window.crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign","verify"])}static async generateClientAssertionJwt(t,n,r,o="HS256"){const i=Math.floor(Date.now()/1e3),s={alg:o,typ:"JWT"},a={iss:t,sub:t,aud:r,jti:lo.generateUUIDv4(),exp:i+300,iat:i},l={HS256:"SHA-256",HS384:"SHA-384",HS512:"SHA-512"}[o];if(!l)throw new Error(`Unsupported algorithm: ${o}. Supported algorithms are: HS256, HS384, HS512`);const c=new TextEncoder,u=await crypto.subtle.importKey("raw",c.encode(n),{name:"HMAC",hash:l},!1,["sign"]);return await Yc.generateSignedJwtWithHmac(s,a,u)}};aI.encodeBase64Url=e=>cv(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");var zt=aI,xi=class{constructor(e){this._name=e,this._callbacks=[],this._logger=new ze(`Event('${this._name}')`)}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){const t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}async raise(...e){this._logger.debug("raise:",...e);for(const t of this._callbacks)await t(...e)}},lI=class{static center({...e}){var t;return e.width==null&&(e.width=(t=[800,720,600,480].find(n=>n<=window.outerWidth/1.618))!=null?t:360),e.left!=null||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),e.height!=null&&(e.top!=null||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t}=${typeof n!="boolean"?n:n?"yes":"no"}`).join(",")}},Ho=class Kg extends xi{constructor(){super(...arguments),this._logger=new ze(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const t=this._expiration-Kg.getEpochTime();this._logger.debug("timer completes in",t),this._expiration<=Kg.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(t){const n=this._logger.create("init");t=Math.max(Math.floor(t),1);const r=Kg.getEpochTime()+t;if(this.expiration===r&&this._timerHandle)return void n.debug("skipping since already initialized for expiration at",this.expiration);this.cancel(),n.debug("using duration",t),this._expiration=r;const o=Math.min(t,5);this._timerHandle=setInterval(this._callback,1e3*o)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},uv=class{static readParams(t,n="query"){if(!t)throw new TypeError("Invalid URL");const r=new URL(t,"http://127.0.0.1")[n==="fragment"?"hash":"search"];return new URLSearchParams(r.slice(1))}},Na=";",Ss=class extends Error{constructor(t,n){var r,o,i;if(super(t.error_description||t.error||""),this.form=n,this.name="ErrorResponse",!t.error)throw ze.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=t.error,this.error_description=(r=t.error_description)!=null?r:null,this.error_uri=(o=t.error_uri)!=null?o:null,this.state=t.userState,this.session_state=(i=t.session_state)!=null?i:null,this.url_state=t.url_state}},dv=class extends Error{constructor(t){super(t),this.name="ErrorTimeout"}},h9=class{constructor(t){this._logger=new ze("AccessTokenEvents"),this._expiringTimer=new Ho("Access token expiring"),this._expiredTimer=new Ho("Access token expired"),this._expiringNotificationTimeInSeconds=t.expiringNotificationTimeInSeconds}async load(t){const n=this._logger.create("load");if(t.access_token&&t.expires_in!==void 0){const r=t.expires_in;if(n.debug("access token present, remaining duration:",r),r>0){let i=r-this._expiringNotificationTimeInSeconds;i<=0&&(i=1),n.debug("registering expiring timer, raising in",i,"seconds"),this._expiringTimer.init(i)}else n.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const o=r+1;n.debug("registering expired timer, raising in",o,"seconds"),this._expiredTimer.init(o)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}async unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(t){return this._expiringTimer.addHandler(t)}removeAccessTokenExpiring(t){this._expiringTimer.removeHandler(t)}addAccessTokenExpired(t){return this._expiredTimer.addHandler(t)}removeAccessTokenExpired(t){this._expiredTimer.removeHandler(t)}},g9=class{constructor(t,n,r,o,i){this._callback=t,this._client_id=n,this._intervalInSeconds=o,this._stopOnError=i,this._logger=new ze("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=a=>{a.origin===this._frame_origin&&a.source===this._frame.contentWindow&&(a.data==="error"?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):a.data==="changed"?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(a.data+" message from check session op iframe"))};const s=new URL(r);this._frame_origin=s.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=s.href}load(){return new Promise(t=>{this._frame.onload=()=>{t()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)})}start(t){if(this._session_state===t)return;this._logger.create("start"),this.stop(),this._session_state=t;const n=()=>{this._frame.contentWindow&&this._session_state&&this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};n(),this._timer=setInterval(n,1e3*this._intervalInSeconds)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}},cI=class{constructor(){this._logger=new ze("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(t){return this._logger.create(`getItem('${t}')`),this._data[t]}setItem(t,n){this._logger.create(`setItem('${t}')`),this._data[t]=n}removeItem(t){this._logger.create(`removeItem('${t}')`),delete this._data[t]}get length(){return Object.getOwnPropertyNames(this._data).length}key(t){return Object.getOwnPropertyNames(this._data)[t]}},pv=class extends Error{constructor(t,n){super(n),this.name="ErrorDPoPNonce",this.nonce=t}},fv=class{constructor(t=[],n=null,r={}){this._jwtHandler=n,this._extraHeaders=r,this._logger=new ze("JsonService"),this._contentTypes=[],this._contentTypes.push(...t,"application/json"),n&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(t,n={}){const{timeoutInSeconds:r,...o}=n;if(!r)return await fetch(t,o);const i=new AbortController,s=setTimeout(()=>i.abort(),1e3*r);try{return await fetch(t,{...n,signal:i.signal})}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?new dv("Network timed out"):a}finally{clearTimeout(s)}}async getJson(t,{token:n,credentials:r,timeoutInSeconds:o}={}){const i=this._logger.create("getJson"),s={Accept:this._contentTypes.join(", ")};let a;n&&(i.debug("token passed, setting Authorization header"),s.Authorization="Bearer "+n),this._appendExtraHeaders(s);try{i.debug("url:",t),a=await this.fetchWithTimeout(t,{method:"GET",headers:s,timeoutInSeconds:o,credentials:r})}catch(u){throw i.error("Network Error"),u}i.debug("HTTP response received, status",a.status);const l=a.headers.get("Content-Type");if(l&&!this._contentTypes.find(u=>l.startsWith(u))&&i.throw(new Error(`Invalid response Content-Type: ${l??"undefined"}, from URL: ${t}`)),a.ok&&this._jwtHandler&&(l==null?void 0:l.startsWith("application/jwt")))return await this._jwtHandler(await a.text());let c;try{c=await a.json()}catch(u){throw i.error("Error parsing JSON response",u),a.ok?u:new Error(`${a.statusText} (${a.status})`)}if(!a.ok)throw i.error("Error from server:",c),c.error?new Ss(c):new Error(`${a.statusText} (${a.status}): ${JSON.stringify(c)}`);return c}async postForm(t,{body:n,basicAuth:r,timeoutInSeconds:o,initCredentials:i,extraHeaders:s}){const a=this._logger.create("postForm"),l={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded",...s};let c;r!==void 0&&(l.Authorization="Basic "+r),this._appendExtraHeaders(l);try{a.debug("url:",t),c=await this.fetchWithTimeout(t,{method:"POST",headers:l,body:n,timeoutInSeconds:o,credentials:i})}catch(m){throw a.error("Network error"),m}a.debug("HTTP response received, status",c.status);const u=c.headers.get("Content-Type");if(u&&!this._contentTypes.find(m=>u.startsWith(m)))throw new Error(`Invalid response Content-Type: ${u??"undefined"}, from URL: ${t}`);const d=await c.text();let p={};if(d)try{p=JSON.parse(d)}catch(m){throw a.error("Error parsing JSON response",m),c.ok?m:new Error(`${c.statusText} (${c.status})`)}if(!c.ok){if(a.error("Error from server:",p),c.headers.has("dpop-nonce")){const m=c.headers.get("dpop-nonce");throw new pv(m,`${JSON.stringify(p)}`)}throw p.error?new Ss(p,n):new Error(`${c.statusText} (${c.status}): ${JSON.stringify(p)}`)}return p}_appendExtraHeaders(t){const n=this._logger.create("appendExtraHeaders"),r=Object.keys(this._extraHeaders),o=["accept","content-type"],i=["authorization"];r.length!==0&&r.forEach(s=>{if(o.includes(s.toLocaleLowerCase()))return void n.warn("Protected header could not be set",s,o);if(i.includes(s.toLocaleLowerCase())&&Object.keys(t).includes(s))return void n.warn("Header could not be overridden",s,i);const a=typeof this._extraHeaders[s]=="function"?this._extraHeaders[s]():this._extraHeaders[s];a&&a!==""&&(t[s]=a)})}},y9=class{constructor(t){this._settings=t,this._logger=new ze("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new fv(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){const t=this._logger.create("getMetadata");if(this._metadata)return t.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw t.throw(new Error("No authority or metadataUrl configured on settings")),null;t.debug("getting metadata from",this._metadataUrl);const n=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return t.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},n,this._settings.metadataSeed),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(t=!0){return this._getMetadataProperty("token_endpoint",t)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(t=!0){return this._getMetadataProperty("revocation_endpoint",t)}getKeysEndpoint(t=!0){return this._getMetadataProperty("jwks_uri",t)}async _getMetadataProperty(t,n=!1){const r=this._logger.create(`_getMetadataProperty('${t}')`),o=await this.getMetadata();if(r.debug("resolved"),o[t]===void 0){if(n===!0)return void r.warn("Metadata does not contain optional property");r.throw(new Error("Metadata does not contain property "+t))}return o[t]}async getSigningKeys(){const t=this._logger.create("getSigningKeys");if(this._signingKeys)return t.debug("returning signingKeys from cache"),this._signingKeys;const n=await this.getKeysEndpoint(!1);t.debug("got jwks_uri",n);const r=await this._jsonService.getJson(n,{timeoutInSeconds:this._settings.requestTimeoutInSeconds});if(t.debug("got key set",r),!Array.isArray(r.keys))throw t.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=r.keys,this._signingKeys}},mv=class{constructor({prefix:t="oidc.",store:n=localStorage}={}){this._logger=new ze("WebStorageStateStore"),this._store=n,this._prefix=t}async set(t,n){this._logger.create(`set('${t}')`),t=this._prefix+t,await this._store.setItem(t,n)}async get(t){return this._logger.create(`get('${t}')`),t=this._prefix+t,await this._store.getItem(t)}async remove(t){this._logger.create(`remove('${t}')`),t=this._prefix+t;const n=await this._store.getItem(t);return await this._store.removeItem(t),n}async getAllKeys(){this._logger.create("getAllKeys");const t=await this._store.length,n=[];for(let r=0;r{const o=this._logger.create("_getClaimsFromJwt");try{const i=Yc.decode(r);return o.debug("JWT decoding successful"),i}catch(i){throw o.error("Error parsing JWT response"),i}},this._jsonService=new fv(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(t){const n=this._logger.create("getClaims");t||this._logger.throw(new Error("No token passed"));const r=await this._metadataService.getUserInfoEndpoint();n.debug("got userinfo url",r);const o=await this._jsonService.getJson(r,{token:t,credentials:this._settings.fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return n.debug("got claims",o),o}},uI=class{constructor(t,n){this._settings=t,this._metadataService=n,this._logger=new ze("TokenClient"),this._jsonService=new fv(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:t="authorization_code",redirect_uri:n=this._settings.redirect_uri,client_id:r=this._settings.client_id,client_secret:o=this._settings.client_secret,extraHeaders:i,...s}){const a=this._logger.create("exchangeCode");r||a.throw(new Error("A client_id is required")),n||a.throw(new Error("A redirect_uri is required")),s.code||a.throw(new Error("A code is required"));const l=new URLSearchParams({grant_type:t,redirect_uri:n});for(const[p,m]of Object.entries(s))m!=null&&l.set(p,m);if((this._settings.client_authentication==="client_secret_basic"||this._settings.client_authentication==="client_secret_jwt")&&o==null)throw a.throw(new Error("A client_secret is required")),null;let c;const u=await this._metadataService.getTokenEndpoint(!1);switch(this._settings.client_authentication){case"client_secret_basic":c=zt.generateBasicAuth(r,o);break;case"client_secret_post":l.append("client_id",r),o&&l.append("client_secret",o);break;case"client_secret_jwt":{const p=await zt.generateClientAssertionJwt(r,o,u,this._settings.token_endpoint_auth_signing_alg);l.append("client_id",r),l.append("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),l.append("client_assertion",p);break}}a.debug("got token endpoint");const d=await this._jsonService.postForm(u,{body:l,basicAuth:c,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:i});return a.debug("got response"),d}async exchangeCredentials({grant_type:t="password",client_id:n=this._settings.client_id,client_secret:r=this._settings.client_secret,scope:o=this._settings.scope,...i}){const s=this._logger.create("exchangeCredentials");n||s.throw(new Error("A client_id is required"));const a=new URLSearchParams({grant_type:t});this._settings.omitScopeWhenRequesting||a.set("scope",o);for(const[d,p]of Object.entries(i))p!=null&&a.set(d,p);if((this._settings.client_authentication==="client_secret_basic"||this._settings.client_authentication==="client_secret_jwt")&&r==null)throw s.throw(new Error("A client_secret is required")),null;let l;const c=await this._metadataService.getTokenEndpoint(!1);switch(this._settings.client_authentication){case"client_secret_basic":l=zt.generateBasicAuth(n,r);break;case"client_secret_post":a.append("client_id",n),r&&a.append("client_secret",r);break;case"client_secret_jwt":{const d=await zt.generateClientAssertionJwt(n,r,c,this._settings.token_endpoint_auth_signing_alg);a.append("client_id",n),a.append("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),a.append("client_assertion",d);break}}s.debug("got token endpoint");const u=await this._jsonService.postForm(c,{body:a,basicAuth:l,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials});return s.debug("got response"),u}async exchangeRefreshToken({grant_type:t="refresh_token",client_id:n=this._settings.client_id,client_secret:r=this._settings.client_secret,timeoutInSeconds:o,extraHeaders:i,...s}){const a=this._logger.create("exchangeRefreshToken");n||a.throw(new Error("A client_id is required")),s.refresh_token||a.throw(new Error("A refresh_token is required"));const l=new URLSearchParams({grant_type:t});for(const[p,m]of Object.entries(s))Array.isArray(m)?m.forEach(h=>l.append(p,h)):m!=null&&l.set(p,m);if((this._settings.client_authentication==="client_secret_basic"||this._settings.client_authentication==="client_secret_jwt")&&r==null)throw a.throw(new Error("A client_secret is required")),null;let c;const u=await this._metadataService.getTokenEndpoint(!1);switch(this._settings.client_authentication){case"client_secret_basic":c=zt.generateBasicAuth(n,r);break;case"client_secret_post":l.append("client_id",n),r&&l.append("client_secret",r);break;case"client_secret_jwt":{const p=await zt.generateClientAssertionJwt(n,r,u,this._settings.token_endpoint_auth_signing_alg);l.append("client_id",n),l.append("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),l.append("client_assertion",p);break}}a.debug("got token endpoint");const d=await this._jsonService.postForm(u,{body:l,basicAuth:c,timeoutInSeconds:o,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:i});return a.debug("got response"),d}async revoke(t){var n;const r=this._logger.create("revoke");t.token||r.throw(new Error("A token is required"));const o=await this._metadataService.getRevocationEndpoint(!1);r.debug(`got revocation endpoint, revoking ${(n=t.token_type_hint)!=null?n:"default token type"}`);const i=new URLSearchParams;for(const[s,a]of Object.entries(t))a!=null&&i.set(s,a);i.set("client_id",this._settings.client_id),this._settings.client_secret&&i.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(o,{body:i,timeoutInSeconds:this._settings.requestTimeoutInSeconds}),r.debug("got response")}},v9=class{constructor(t,n,r){this._settings=t,this._metadataService=n,this._claimsService=r,this._logger=new ze("ResponseValidator"),this._userInfoService=new w9(this._settings,this._metadataService),this._tokenClient=new uI(this._settings,this._metadataService)}async validateSigninResponse(t,n,r){const o=this._logger.create("validateSigninResponse");this._processSigninState(t,n),o.debug("state processed"),await this._processCode(t,n,r),o.debug("code processed"),t.isOpenId&&this._validateIdTokenAttributes(t),o.debug("tokens validated"),await this._processClaims(t,n==null?void 0:n.skipUserInfo,t.isOpenId),o.debug("claims processed")}async validateCredentialsResponse(t,n){const r=this._logger.create("validateCredentialsResponse"),o=t.isOpenId&&!!t.id_token;o&&this._validateIdTokenAttributes(t),r.debug("tokens validated"),await this._processClaims(t,n,o),r.debug("claims processed")}async validateRefreshResponse(t,n){const r=this._logger.create("validateRefreshResponse");t.userState=n.data,t.session_state!=null||(t.session_state=n.session_state),t.scope!=null||(t.scope=n.scope),t.isOpenId&&t.id_token&&(this._validateIdTokenAttributes(t,n.id_token),r.debug("ID Token validated")),t.id_token||(t.id_token=n.id_token,t.profile=n.profile);const o=t.isOpenId&&!!t.id_token;await this._processClaims(t,!1,o),r.debug("claims processed")}validateSignoutResponse(t,n){const r=this._logger.create("validateSignoutResponse");if(n.id!==t.state&&r.throw(new Error("State does not match")),r.debug("state validated"),t.userState=n.data,t.error)throw r.warn("Response was error",t.error),new Ss(t)}_processSigninState(t,n){const r=this._logger.create("_processSigninState");if(n.id!==t.state&&r.throw(new Error("State does not match")),n.client_id||r.throw(new Error("No client_id on state")),n.authority||r.throw(new Error("No authority on state")),this._settings.authority!==n.authority&&r.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==n.client_id&&r.throw(new Error("client_id mismatch on settings vs. signin state")),r.debug("state validated"),t.userState=n.data,t.url_state=n.url_state,t.scope!=null||(t.scope=n.scope),t.error)throw r.warn("Response was error",t.error),new Ss(t);n.code_verifier&&!t.code&&r.throw(new Error("Expected code in response"))}async _processClaims(t,n=!1,r=!0){const o=this._logger.create("_processClaims");if(t.profile=this._claimsService.filterProtocolClaims(t.profile),n||!this._settings.loadUserInfo||!t.access_token)return void o.debug("not loading user info");o.debug("loading user info");const i=await this._userInfoService.getClaims(t.access_token);o.debug("user info claims received from user info endpoint"),r&&i.sub!==t.profile.sub&&o.throw(new Error("subject from UserInfo response does not match subject in ID Token")),t.profile=this._claimsService.mergeClaims(t.profile,this._claimsService.filterProtocolClaims(i)),o.debug("user info claims received, updated profile:",t.profile)}async _processCode(t,n,r){const o=this._logger.create("_processCode");if(t.code){o.debug("Validating code");const i=await this._tokenClient.exchangeCode({client_id:n.client_id,client_secret:n.client_secret,code:t.code,redirect_uri:n.redirect_uri,code_verifier:n.code_verifier,extraHeaders:r,...n.extraTokenParams});Object.assign(t,i)}else o.debug("No code to process")}_validateIdTokenAttributes(t,n){var r;const o=this._logger.create("_validateIdTokenAttributes");o.debug("decoding ID Token JWT");const i=Yc.decode((r=t.id_token)!=null?r:"");if(i.sub||o.throw(new Error("ID Token is missing a subject claim")),n){const s=Yc.decode(n);i.sub!==s.sub&&o.throw(new Error("sub in id_token does not match current sub")),i.auth_time&&i.auth_time!==s.auth_time&&o.throw(new Error("auth_time in id_token does not match original auth_time")),i.azp&&i.azp!==s.azp&&o.throw(new Error("azp in id_token does not match original azp")),!i.azp&&s.azp&&o.throw(new Error("azp not in id_token, but present in original id_token"))}t.profile=i}},df=class c0{constructor(t){this.id=t.id||zt.generateUUIDv4(),this.data=t.data,t.created&&t.created>0?this.created=t.created:this.created=Ho.getEpochTime(),this.request_type=t.request_type,this.url_state=t.url_state}toStorageString(){return new ze("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}static fromStorageString(t){return ze.createStatic("State","fromStorageString"),Promise.resolve(new c0(JSON.parse(t)))}static async clearStaleState(t,n){const r=ze.createStatic("State","clearStaleState"),o=Ho.getEpochTime()-n,i=await t.getAllKeys();r.debug("got keys",i);for(let s=0;sS.searchParams.append("resource",C));for(const[C,O]of Object.entries({response_mode:l,..._,...w}))O!=null&&S.searchParams.append(C,O.toString());return new t2({url:S.href,state:E})}};pI._logger=new ze("SigninRequest");var _9=pI,gv=class{constructor(t){if(this.access_token="",this.token_type="",this.profile={},this.state=t.get("state"),this.session_state=t.get("session_state"),this.state){const n=decodeURIComponent(this.state).split(Na);this.state=n[0],n.length>1&&(this.url_state=n.slice(1).join(Na))}this.error=t.get("error"),this.error_description=t.get("error_description"),this.error_uri=t.get("error_uri"),this.code=t.get("code")}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-Ho.getEpochTime()}set expires_in(t){typeof t=="string"&&(t=Number(t)),t!==void 0&&t>=0&&(this.expires_at=Math.floor(t)+Ho.getEpochTime())}get isOpenId(){var t;return((t=this.scope)==null?void 0:t.split(" ").includes("openid"))||!!this.id_token}},b9=class{constructor({url:t,state_data:n,id_token_hint:r,post_logout_redirect_uri:o,extraQueryParams:i,request_type:s,client_id:a,url_state:l}){if(this._logger=new ze("SignoutRequest"),!t)throw this._logger.error("ctor: No url passed"),new Error("url");const c=new URL(t);if(r&&c.searchParams.append("id_token_hint",r),a&&c.searchParams.append("client_id",a),o&&(c.searchParams.append("post_logout_redirect_uri",o),n||l)){this.state=new df({data:n,request_type:s,url_state:l});let u=this.state.id;l&&(u=`${u}${Na}${l}`),c.searchParams.append("state",u)}for(const[u,d]of Object.entries({...i}))d!=null&&c.searchParams.append(u,d.toString());this.url=c.href}},E9=class{constructor(t){if(this.state=t.get("state"),this.state){const n=decodeURIComponent(this.state).split(Na);this.state=n[0],n.length>1&&(this.url_state=n.slice(1).join(Na))}this.error=t.get("error"),this.error_description=t.get("error_description"),this.error_uri=t.get("error_uri")}},S9=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],T9=["sub","iss","aud","exp","iat"],k9=class{constructor(t){this._settings=t,this._logger=new ze("ClaimsService")}filterProtocolClaims(t){const n={...t};if(this._settings.filterProtocolClaims){let r;r=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:S9;for(const o of r)T9.includes(o)||delete n[o]}return n}mergeClaims(t,n){const r={...t};for(const[o,i]of Object.entries(n))if(r[o]!==i)if(Array.isArray(r[o])||Array.isArray(i))if(this._settings.mergeClaimsStrategy.array=="replace")r[o]=i;else{const s=Array.isArray(r[o])?r[o]:[r[o]];for(const a of Array.isArray(i)?i:[i])s.includes(a)||s.push(a);r[o]=s}else typeof r[o]=="object"&&typeof i=="object"?r[o]=this.mergeClaims(r[o],i):r[o]=i;return r}},fI=class{constructor(t,n){this.keys=t,this.nonce=n}},x9=class{constructor(e,t){this._logger=new ze("OidcClient"),this.settings=e instanceof hv?e:new hv(e),this.metadataService=t??new y9(this.settings),this._claimsService=new k9(this.settings),this._validator=new v9(this.settings,this.metadataService,this._claimsService),this._tokenClient=new uI(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:n,request_type:r,id_token_hint:o,login_hint:i,skipUserInfo:s,nonce:a,url_state:l,response_type:c=this.settings.response_type,scope:u=this.settings.scope,redirect_uri:d=this.settings.redirect_uri,prompt:p=this.settings.prompt,display:m=this.settings.display,max_age:h=this.settings.max_age,ui_locales:w=this.settings.ui_locales,acr_values:v=this.settings.acr_values,resource:f=this.settings.resource,response_mode:g=this.settings.response_mode,extraQueryParams:y=this.settings.extraQueryParams,extraTokenParams:_=this.settings.extraTokenParams,dpopJkt:E,omitScopeWhenRequesting:S=this.settings.omitScopeWhenRequesting}){const k=this._logger.create("createSigninRequest");if(c!=="code")throw new Error("Only the Authorization Code flow (with PKCE) is supported");const C=await this.metadataService.getAuthorizationEndpoint();k.debug("Received authorization endpoint",C);const O=await _9.create({url:C,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:d,response_type:c,scope:u,state_data:e,url_state:l,prompt:p,display:m,max_age:h,ui_locales:w,id_token_hint:o,login_hint:i,acr_values:v,dpopJkt:E,resource:f,request:t,request_uri:n,extraQueryParams:y,extraTokenParams:_,request_type:r,response_mode:g,client_secret:this.settings.client_secret,skipUserInfo:s,nonce:a,disablePKCE:this.settings.disablePKCE,omitScopeWhenRequesting:S});await this.clearStaleState();const U=O.state;return await this.settings.stateStore.set(U.id,U.toStorageString()),O}async readSigninResponseState(e,t=!1){const n=this._logger.create("readSigninResponseState"),r=new gv(uv.readParams(e,this.settings.response_mode));if(!r.state)throw n.throw(new Error("No state in response")),null;const o=await this.settings.stateStore[t?"remove":"get"](r.state);if(!o)throw n.throw(new Error("No matching state found in storage")),null;return{state:await dI.fromStorageString(o),response:r}}async processSigninResponse(e,t,n=!0){const r=this._logger.create("processSigninResponse"),{state:o,response:i}=await this.readSigninResponseState(e,n);if(r.debug("received state from storage; validating response"),this.settings.dpop&&this.settings.dpop.store){const s=await this.getDpopProof(this.settings.dpop.store);t={...t,DPoP:s}}try{await this._validator.validateSigninResponse(i,o,t)}catch(s){if(!(s instanceof pv&&this.settings.dpop))throw s;{const a=await this.getDpopProof(this.settings.dpop.store,s.nonce);t.DPoP=a,await this._validator.validateSigninResponse(i,o,t)}}return i}async getDpopProof(e,t){let n,r;return(await e.getAllKeys()).includes(this.settings.client_id)?(r=await e.get(this.settings.client_id),r.nonce!==t&&t&&(r.nonce=t,await e.set(this.settings.client_id,r))):(n=await zt.generateDPoPKeys(),r=new fI(n,t),await e.set(this.settings.client_id,r)),await zt.generateDPoPProof({url:await this.metadataService.getTokenEndpoint(!1),httpMethod:"POST",keyPair:r.keys,nonce:r.nonce})}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:n=!1,extraTokenParams:r={}}){const o=await this._tokenClient.exchangeCredentials({username:e,password:t,...r}),i=new gv(new URLSearchParams);return Object.assign(i,o),await this._validator.validateCredentialsResponse(i,n),i}async useRefreshToken({state:e,redirect_uri:t,resource:n,timeoutInSeconds:r,extraHeaders:o,extraTokenParams:i}){var s;const a=this._logger.create("useRefreshToken");let l,c;if(this.settings.refreshTokenAllowedScope===void 0)l=e.scope;else{const d=this.settings.refreshTokenAllowedScope.split(" ");l=(((s=e.scope)==null?void 0:s.split(" "))||[]).filter(p=>d.includes(p)).join(" ")}if(this.settings.dpop&&this.settings.dpop.store){const d=await this.getDpopProof(this.settings.dpop.store);o={...o,DPoP:d}}try{c=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:l,redirect_uri:t,resource:n,timeoutInSeconds:r,extraHeaders:o,...i})}catch(d){if(!(d instanceof pv&&this.settings.dpop))throw d;o.DPoP=await this.getDpopProof(this.settings.dpop.store,d.nonce),c=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:l,redirect_uri:t,resource:n,timeoutInSeconds:r,extraHeaders:o,...i})}const u=new gv(new URLSearchParams);return Object.assign(u,c),a.debug("validating response",u),await this._validator.validateRefreshResponse(u,{...e,scope:l}),u}async createSignoutRequest({state:e,id_token_hint:t,client_id:n,request_type:r,url_state:o,post_logout_redirect_uri:i=this.settings.post_logout_redirect_uri,extraQueryParams:s=this.settings.extraQueryParams}={}){const a=this._logger.create("createSignoutRequest"),l=await this.metadataService.getEndSessionEndpoint();if(!l)throw a.throw(new Error("No end session endpoint")),null;a.debug("Received end session endpoint",l),n||!i||t||(n=this.settings.client_id);const c=new b9({url:l,id_token_hint:t,client_id:n,post_logout_redirect_uri:i,state_data:e,extraQueryParams:s,request_type:r,url_state:o});await this.clearStaleState();const u=c.state;return u&&(a.debug("Signout request has state to persist"),await this.settings.stateStore.set(u.id,u.toStorageString())),c}async readSignoutResponseState(e,t=!1){const n=this._logger.create("readSignoutResponseState"),r=new E9(uv.readParams(e,this.settings.response_mode));if(!r.state){if(n.debug("No state in response"),r.error)throw n.warn("Response was error:",r.error),new Ss(r);return{state:void 0,response:r}}const o=await this.settings.stateStore[t?"remove":"get"](r.state);if(!o)throw n.throw(new Error("No matching state found in storage")),null;return{state:await df.fromStorageString(o),response:r}}async processSignoutResponse(e){const t=this._logger.create("processSignoutResponse"),{state:n,response:r}=await this.readSignoutResponseState(e,!0);return n?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(r,n)):t.debug("No state from storage; skipping response validation"),r}clearStaleState(){return this._logger.create("clearStaleState"),df.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}},C9=class{constructor(t){this._userManager=t,this._logger=new ze("SessionMonitor"),this._start=async n=>{const r=n.session_state;if(!r)return;const o=this._logger.create("_start");if(n.profile?(this._sub=n.profile.sub,o.debug("session_state",r,", sub",this._sub)):(this._sub=void 0,o.debug("session_state",r,", anonymous user")),this._checkSessionIFrame)this._checkSessionIFrame.start(r);else try{const i=await this._userManager.metadataService.getCheckSessionIframe();if(i){o.debug("initializing check session iframe");const s=this._userManager.settings.client_id,a=this._userManager.settings.checkSessionIntervalInSeconds,l=this._userManager.settings.stopCheckSessionOnError,c=new g9(this._callback,s,i,a,l);await c.load(),this._checkSessionIFrame=c,c.start(r)}else o.warn("no check session iframe found in the metadata")}catch(i){o.error("Error from getCheckSessionIframe:",i instanceof Error?i.message:i)}},this._stop=()=>{const n=this._logger.create("_stop");if(this._sub=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const r=setInterval(async()=>{clearInterval(r);try{const o=await this._userManager.querySessionStatus();if(o){const i={session_state:o.session_state,profile:o.sub?{sub:o.sub}:null};this._start(i)}}catch(o){n.error("error from querySessionStatus",o instanceof Error?o.message:o)}},1e3)}},this._callback=async()=>{const n=this._logger.create("_callback");try{const r=await this._userManager.querySessionStatus();let o=!0;r&&this._checkSessionIFrame?r.sub===this._sub?(o=!1,this._checkSessionIFrame.start(r.session_state),n.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",r.session_state),await this._userManager.events._raiseUserSessionChanged()):n.debug("different subject signed into OP",r.sub):n.debug("subject no longer signed into OP"),o?this._sub?await this._userManager.events._raiseUserSignedOut():await this._userManager.events._raiseUserSignedIn():n.debug("no change in session detected, no event to raise")}catch(r){this._sub&&(n.debug("Error calling queryCurrentSigninSession; raising signed out event",r),await this._userManager.events._raiseUserSignedOut())}},t||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch(n=>{this._logger.error(n)})}async _init(){this._logger.create("_init");const t=await this._userManager.getUser();if(t)this._start(t);else if(this._userManager.settings.monitorAnonymousSession){const n=await this._userManager.querySessionStatus();if(n){const r={session_state:n.session_state,profile:n.sub?{sub:n.sub}:null};this._start(r)}}}},pf=class n2{constructor(t){var n;this.id_token=t.id_token,this.session_state=(n=t.session_state)!=null?n:null,this.access_token=t.access_token,this.refresh_token=t.refresh_token,this.token_type=t.token_type,this.scope=t.scope,this.profile=t.profile,this.expires_at=t.expires_at,this.state=t.userState,this.url_state=t.url_state}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-Ho.getEpochTime()}set expires_in(t){t!==void 0&&(this.expires_at=Math.floor(t)+Ho.getEpochTime())}get expired(){const t=this.expires_in;if(t!==void 0)return t<=0}get scopes(){var t,n;return(n=(t=this.scope)==null?void 0:t.split(" "))!=null?n:[]}toStorageString(){return new ze("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(t){return ze.createStatic("User","fromStorageString"),new n2(JSON.parse(t))}},mI="oidc-client",hI=class{constructor(){this._abort=new xi("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(t){const n=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");n.debug("setting URL in window"),this._window.location.replace(t.url);const{url:r,keepOpen:o}=await new Promise((i,s)=>{const a=c=>{var u;const d=c.data,p=(u=t.scriptOrigin)!=null?u:window.location.origin;if(c.origin===p&&(d==null?void 0:d.source)===mI){try{const m=uv.readParams(d.url,t.response_mode).get("state");if(m||n.warn("no state found in response url"),c.source!==this._window&&m!==t.state)return}catch{this._dispose(),s(new Error("Invalid response from window"))}i(d)}};window.addEventListener("message",a,!1),this._disposeHandlers.add(()=>window.removeEventListener("message",a,!1));const l=new BroadcastChannel(`oidc-client-popup-${t.state}`);l.addEventListener("message",a,!1),this._disposeHandlers.add(()=>l.close()),this._disposeHandlers.add(this._abort.addHandler(c=>{this._dispose(),s(c)}))});return n.debug("got response from window"),this._dispose(),o||this.close(),{url:r}}_dispose(){this._logger.create("_dispose");for(const t of this._disposeHandlers)t();this._disposeHandlers.clear()}static _notifyParent(t,n,r=!1,o=window.location.origin){const i={source:mI,url:n,keepOpen:r},s=new ze("_notifyParent");if(t)s.debug("With parent. Using parent.postMessage."),t.postMessage(i,o);else{s.debug("No parent. Using BroadcastChannel.");const a=new URL(n).searchParams.get("state");if(!a)throw new Error("No parent and no state in URL. Can't complete notification.");const l=new BroadcastChannel(`oidc-client-popup-${a}`);l.postMessage(i),l.close()}}},gI={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},yI="_blank",I9=60,P9=2,R9=class extends hv{constructor(t){const{popup_redirect_uri:n=t.redirect_uri,popup_post_logout_redirect_uri:r=t.post_logout_redirect_uri,popupWindowFeatures:o=gI,popupWindowTarget:i=yI,redirectMethod:s="assign",redirectTarget:a="self",iframeNotifyParentOrigin:l=t.iframeNotifyParentOrigin,iframeScriptOrigin:c=t.iframeScriptOrigin,requestTimeoutInSeconds:u,silent_redirect_uri:d=t.redirect_uri,silentRequestTimeoutInSeconds:p,automaticSilentRenew:m=!0,validateSubOnSilentRenew:h=!0,includeIdTokenInSilentRenew:w=!1,monitorSession:v=!1,monitorAnonymousSession:f=!1,checkSessionIntervalInSeconds:g=P9,query_status_response_type:y="code",stopCheckSessionOnError:_=!0,revokeTokenTypes:E=["access_token","refresh_token"],revokeTokensOnSignout:S=!1,includeIdTokenInSilentSignout:k=!1,accessTokenExpiringNotificationTimeInSeconds:C=I9,userStore:O}=t;if(super(t),this.popup_redirect_uri=n,this.popup_post_logout_redirect_uri=r,this.popupWindowFeatures=o,this.popupWindowTarget=i,this.redirectMethod=s,this.redirectTarget=a,this.iframeNotifyParentOrigin=l,this.iframeScriptOrigin=c,this.silent_redirect_uri=d,this.silentRequestTimeoutInSeconds=p||u||10,this.automaticSilentRenew=m,this.validateSubOnSilentRenew=h,this.includeIdTokenInSilentRenew=w,this.monitorSession=v,this.monitorAnonymousSession=f,this.checkSessionIntervalInSeconds=g,this.stopCheckSessionOnError=_,this.query_status_response_type=y,this.revokeTokenTypes=E,this.revokeTokensOnSignout=S,this.includeIdTokenInSilentSignout=k,this.accessTokenExpiringNotificationTimeInSeconds=C,O)this.userStore=O;else{const U=typeof window<"u"?window.sessionStorage:new cI;this.userStore=new mv({store:U})}}},wI=class r2 extends hI{constructor({silentRequestTimeoutInSeconds:t=10}){super(),this._logger=new ze("IFrameWindow"),this._timeoutInSeconds=t,this._frame=r2.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const t=window.document.createElement("iframe");return t.style.visibility="hidden",t.style.position="fixed",t.style.left="-1000px",t.style.top="0",t.width="0",t.height="0",window.document.body.appendChild(t),t}async navigate(t){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);const n=setTimeout(()=>{this._abort.raise(new dv("IFrame timed out without a response"))},1e3*this._timeoutInSeconds);return this._disposeHandlers.add(()=>clearTimeout(n)),await super.navigate(t)}close(){var t;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",n=>{var r;const o=n.target;(r=o.parentNode)==null||r.removeChild(o),this._abort.raise(new Error("IFrame removed from DOM"))},!0),(t=this._frame.contentWindow)==null||t.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(t,n){return super._notifyParent(window.parent,t,!1,n)}},A9=class{constructor(t){this._settings=t,this._logger=new ze("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:t=this._settings.silentRequestTimeoutInSeconds}){return new wI({silentRequestTimeoutInSeconds:t})}async callback(t){this._logger.create("callback"),wI.notifyParent(t,this._settings.iframeNotifyParentOrigin)}},vI=class extends hI{constructor({popupWindowTarget:t=yI,popupWindowFeatures:n={},popupSignal:r,popupAbortOnClose:o}){super(),this._logger=new ze("PopupWindow");const i=lI.center({...gI,...n});this._window=window.open(void 0,t,lI.serialize(i)),this.abortOnClose=!!o,r&&r.addEventListener("abort",()=>{var s;this._abort.raise(new Error((s=r.reason)!=null?s:"Popup aborted"))}),n.closePopupWindowAfterInSeconds&&n.closePopupWindowAfterInSeconds>0&&setTimeout(()=>{this._window&&typeof this._window.closed=="boolean"&&!this._window.closed?this.close():this._abort.raise(new Error("Popup blocked by user"))},1e3*n.closePopupWindowAfterInSeconds)}async navigate(t){var n;(n=this._window)==null||n.focus();const r=setInterval(()=>{this._window&&!this._window.closed||(this._logger.debug("Popup closed by user or isolated by redirect"),o(),this._disposeHandlers.delete(o),this.abortOnClose&&this._abort.raise(new Error("Popup closed by user")))},500),o=()=>clearInterval(r);return this._disposeHandlers.add(o),await super.navigate(t)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(t,n){super._notifyParent(window.opener,t,n),n||window.opener||window.close()}},$9=class{constructor(t){this._settings=t,this._logger=new ze("PopupNavigator")}async prepare({popupWindowFeatures:t=this._settings.popupWindowFeatures,popupWindowTarget:n=this._settings.popupWindowTarget,popupSignal:r,popupAbortOnClose:o}){return new vI({popupWindowFeatures:t,popupWindowTarget:n,popupSignal:r,popupAbortOnClose:o})}async callback(t,{keepOpen:n=!1}){this._logger.create("callback"),vI.notifyOpener(t,n)}},O9=class{constructor(t){this._settings=t,this._logger=new ze("RedirectNavigator")}async prepare({redirectMethod:t=this._settings.redirectMethod,redirectTarget:n=this._settings.redirectTarget}){var r;this._logger.create("prepare");let o=window.self;n==="top"&&(o=(r=window.top)!=null?r:window.self);const i=o.location[t].bind(o.location);let s;return{navigate:async a=>(this._logger.create("navigate"),await new Promise((c,u)=>{s=u,window.addEventListener("pageshow",()=>c(window.location.href)),i(a.url)})),close:()=>{this._logger.create("close"),s==null||s(new Error("Redirect aborted")),o.stop()}}}async callback(){}},N9=class extends h9{constructor(t){super({expiringNotificationTimeInSeconds:t.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new ze("UserManagerEvents"),this._userLoaded=new xi("User loaded"),this._userUnloaded=new xi("User unloaded"),this._silentRenewError=new xi("Silent renew error"),this._userSignedIn=new xi("User signed in"),this._userSignedOut=new xi("User signed out"),this._userSessionChanged=new xi("User session changed")}async load(t,n=!0){await super.load(t),n&&await this._userLoaded.raise(t)}async unload(){await super.unload(),await this._userUnloaded.raise()}addUserLoaded(t){return this._userLoaded.addHandler(t)}removeUserLoaded(t){return this._userLoaded.removeHandler(t)}addUserUnloaded(t){return this._userUnloaded.addHandler(t)}removeUserUnloaded(t){return this._userUnloaded.removeHandler(t)}addSilentRenewError(t){return this._silentRenewError.addHandler(t)}removeSilentRenewError(t){return this._silentRenewError.removeHandler(t)}async _raiseSilentRenewError(t){await this._silentRenewError.raise(t)}addUserSignedIn(t){return this._userSignedIn.addHandler(t)}removeUserSignedIn(t){this._userSignedIn.removeHandler(t)}async _raiseUserSignedIn(){await this._userSignedIn.raise()}addUserSignedOut(t){return this._userSignedOut.addHandler(t)}removeUserSignedOut(t){this._userSignedOut.removeHandler(t)}async _raiseUserSignedOut(){await this._userSignedOut.raise()}addUserSessionChanged(t){return this._userSessionChanged.addHandler(t)}removeUserSessionChanged(t){this._userSessionChanged.removeHandler(t)}async _raiseUserSessionChanged(){await this._userSessionChanged.raise()}},L9=class{constructor(t){this._userManager=t,this._logger=new ze("SilentRenewService"),this._isStarted=!1,this._retryTimer=new Ho("Retry Silent Renew"),this._tokenExpiring=async()=>{const n=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),n.debug("silent token renewal successful")}catch(r){if(r instanceof dv)return n.warn("ErrorTimeout from signinSilent:",r,"retry in 5s"),void this._retryTimer.init(5);n.error("Error from signinSilent:",r),await this._userManager.events._raiseSilentRenewError(r)}}}async start(){const t=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(n){t.error("getUser error",n)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}},M9=class{constructor(t){this.refresh_token=t.refresh_token,this.id_token=t.id_token,this.session_state=t.session_state,this.scope=t.scope,this.profile=t.profile,this.data=t.state}},D9=class{constructor(t,n,r,o){this._logger=new ze("UserManager"),this.settings=new R9(t),this._client=new x9(t),this._redirectNavigator=n??new O9(this.settings),this._popupNavigator=r??new $9(this.settings),this._iframeNavigator=o??new A9(this.settings),this._events=new N9(this.settings),this._silentRenewService=new L9(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new C9(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(t=!1){const n=this._logger.create("getUser"),r=await this._loadUser();return r?(n.info("user loaded"),await this._events.load(r,t),r):(n.info("user not found in storage"),null)}async removeUser(){const t=this._logger.create("removeUser");await this.storeUser(null),t.info("user removed from storage"),await this._events.unload()}async signinRedirect(t={}){var n;this._logger.create("signinRedirect");const{redirectMethod:r,...o}=t;let i;(n=this.settings.dpop)!=null&&n.bind_authorization_code&&(i=await this.generateDPoPJkt(this.settings.dpop));const s=await this._redirectNavigator.prepare({redirectMethod:r});await this._signinStart({request_type:"si:r",dpopJkt:i,...o},s)}async signinRedirectCallback(t=window.location.href){const n=this._logger.create("signinRedirectCallback"),r=await this._signinEnd(t);return r.profile&&r.profile.sub?n.info("success, signed in subject",r.profile.sub):n.info("no subject"),r}async signinResourceOwnerCredentials({username:t,password:n,skipUserInfo:r=!1}){const o=this._logger.create("signinResourceOwnerCredential"),i=await this._client.processResourceOwnerPasswordCredentials({username:t,password:n,skipUserInfo:r,extraTokenParams:this.settings.extraTokenParams});o.debug("got signin response");const s=await this._buildUser(i);return s.profile&&s.profile.sub?o.info("success, signed in subject",s.profile.sub):o.info("no subject"),s}async signinPopup(t={}){var n;const r=this._logger.create("signinPopup");let o;(n=this.settings.dpop)!=null&&n.bind_authorization_code&&(o=await this.generateDPoPJkt(this.settings.dpop));const{popupWindowFeatures:i,popupWindowTarget:s,popupSignal:a,popupAbortOnClose:l,...c}=t,u=this.settings.popup_redirect_uri;u||r.throw(new Error("No popup_redirect_uri configured"));const d=await this._popupNavigator.prepare({popupWindowFeatures:i,popupWindowTarget:s,popupSignal:a,popupAbortOnClose:l}),p=await this._signin({request_type:"si:p",redirect_uri:u,display:"popup",dpopJkt:o,...c},d);return p&&(p.profile&&p.profile.sub?r.info("success, signed in subject",p.profile.sub):r.info("no subject")),p}async signinPopupCallback(t=window.location.href,n=!1){const r=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(t,{keepOpen:n}),r.info("success")}async signinSilent(t={}){var n,r;const o=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:i,...s}=t;let a,l=await this._loadUser();if(!t.forceIframeAuth&&(l!=null&&l.refresh_token)){o.debug("using refresh token");const p=new M9(l);return await this._useRefreshToken({state:p,redirect_uri:s.redirect_uri,resource:s.resource,extraTokenParams:s.extraTokenParams,timeoutInSeconds:i})}(n=this.settings.dpop)!=null&&n.bind_authorization_code&&(a=await this.generateDPoPJkt(this.settings.dpop));const c=this.settings.silent_redirect_uri;let u;c||o.throw(new Error("No silent_redirect_uri configured")),l&&this.settings.validateSubOnSilentRenew&&(o.debug("subject prior to silent renew:",l.profile.sub),u=l.profile.sub);const d=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:i});return l=await this._signin({request_type:"si:s",redirect_uri:c,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?l==null?void 0:l.id_token:void 0,dpopJkt:a,...s},d,u),l&&((r=l.profile)!=null&&r.sub?o.info("success, signed in subject",l.profile.sub):o.info("no subject")),l}async _useRefreshToken(t){const n=await this._client.useRefreshToken({timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds,...t}),r=new pf({...t.state,...n});return await this.storeUser(r),await this._events.load(r),r}async signinSilentCallback(t=window.location.href){const n=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(t),n.info("success")}async signinCallback(t=window.location.href){const{state:n}=await this._client.readSigninResponseState(t);switch(n.request_type){case"si:r":return await this.signinRedirectCallback(t);case"si:p":await this.signinPopupCallback(t);break;case"si:s":await this.signinSilentCallback(t);break;default:throw new Error("invalid response_type in state")}}async signoutCallback(t=window.location.href,n=!1){const{state:r}=await this._client.readSignoutResponseState(t);if(r)switch(r.request_type){case"so:r":return await this.signoutRedirectCallback(t);case"so:p":await this.signoutPopupCallback(t,n);break;case"so:s":await this.signoutSilentCallback(t);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(t={}){const n=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:r,...o}=t,i=this.settings.silent_redirect_uri;i||n.throw(new Error("No silent_redirect_uri configured"));const s=await this._loadUser(),a=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r}),l=await this._signinStart({request_type:"si:s",redirect_uri:i,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?s==null?void 0:s.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...o},a);try{const c={},u=await this._client.processSigninResponse(l.url,c);return n.debug("got signin response"),u.session_state&&u.profile.sub?(n.info("success for subject",u.profile.sub),{session_state:u.session_state,sub:u.profile.sub}):(n.info("success, user not authenticated"),null)}catch(c){if(this.settings.monitorAnonymousSession&&c instanceof Ss)switch(c.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return n.info("success for anonymous user"),{session_state:c.session_state}}throw c}}async _signin(t,n,r){const o=await this._signinStart(t,n);return await this._signinEnd(o.url,r)}async _signinStart(t,n){const r=this._logger.create("_signinStart");try{const o=await this._client.createSigninRequest(t);return r.debug("got signin request"),await n.navigate({url:o.url,state:o.state.id,response_mode:o.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(o){throw r.debug("error after preparing navigator, closing navigator window"),n.close(),o}}async _signinEnd(t,n){const r=this._logger.create("_signinEnd"),o=await this._client.processSigninResponse(t,{});return r.debug("got signin response"),await this._buildUser(o,n)}async _buildUser(t,n){const r=this._logger.create("_buildUser"),o=new pf(t);if(n){if(n!==o.profile.sub)throw r.debug("current user does not match user returned from signin. sub from signin:",o.profile.sub),new Ss({...t,error:"login_required"});r.debug("current user matches user returned from signin")}return await this.storeUser(o),r.debug("user stored"),await this._events.load(o),o}async signoutRedirect(t={}){const n=this._logger.create("signoutRedirect"),{redirectMethod:r,...o}=t,i=await this._redirectNavigator.prepare({redirectMethod:r});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...o},i),n.info("success")}async signoutRedirectCallback(t=window.location.href){const n=this._logger.create("signoutRedirectCallback"),r=await this._signoutEnd(t);return n.info("success"),r}async signoutPopup(t={}){const n=this._logger.create("signoutPopup"),{popupWindowFeatures:r,popupWindowTarget:o,popupSignal:i,...s}=t,a=this.settings.popup_post_logout_redirect_uri,l=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:o,popupSignal:i});await this._signout({request_type:"so:p",post_logout_redirect_uri:a,state:a==null?void 0:{},...s},l),n.info("success")}async signoutPopupCallback(t=window.location.href,n=!1){const r=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(t,{keepOpen:n}),r.info("success")}async _signout(t,n){const r=await this._signoutStart(t,n);return await this._signoutEnd(r.url)}async _signoutStart(t={},n){var r;const o=this._logger.create("_signoutStart");try{const i=await this._loadUser();o.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(i);const s=t.id_token_hint||i&&i.id_token;s&&(o.debug("setting id_token_hint in signout request"),t.id_token_hint=s),await this.removeUser(),o.debug("user removed, creating signout request");const a=await this._client.createSignoutRequest(t);return o.debug("got signout request"),await n.navigate({url:a.url,state:(r=a.state)==null?void 0:r.id,scriptOrigin:this.settings.iframeScriptOrigin})}catch(i){throw o.debug("error after preparing navigator, closing navigator window"),n.close(),i}}async _signoutEnd(t){const n=this._logger.create("_signoutEnd"),r=await this._client.processSignoutResponse(t);return n.debug("got signout response"),r}async signoutSilent(t={}){var n;const r=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:o,...i}=t,s=this.settings.includeIdTokenInSilentSignout?(n=await this._loadUser())==null?void 0:n.id_token:void 0,a=this.settings.popup_post_logout_redirect_uri,l=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:o});await this._signout({request_type:"so:s",post_logout_redirect_uri:a,id_token_hint:s,...i},l),r.info("success")}async signoutSilentCallback(t=window.location.href){const n=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(t),n.info("success")}async revokeTokens(t){const n=await this._loadUser();await this._revokeInternal(n,t)}async _revokeInternal(t,n=this.settings.revokeTokenTypes){const r=this._logger.create("_revokeInternal");if(!t)return;const o=n.filter(i=>typeof t[i]=="string");if(o.length){for(const i of o)await this._client.revokeToken(t[i],i),r.info(`${i} revoked successfully`),i!=="access_token"&&(t[i]=null);await this.storeUser(t),r.debug("user stored"),await this._events.load(t)}else r.debug("no need to revoke due to no token(s)")}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){const t=this._logger.create("_loadUser"),n=await this.settings.userStore.get(this._userStoreKey);return n?(t.debug("user storageString loaded"),pf.fromStorageString(n)):(t.debug("no user storageString"),null)}async storeUser(t){const n=this._logger.create("storeUser");if(t){n.debug("storing user");const r=t.toStorageString();await this.settings.userStore.set(this._userStoreKey,r)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey),this.settings.dpop&&await this.settings.dpop.store.remove(this.settings.client_id)}async clearStaleState(){await this._client.clearStaleState()}async dpopProof(t,n,r,o){var i,s;const a=await((s=(i=this.settings.dpop)==null?void 0:i.store)==null?void 0:s.get(this.settings.client_id));if(a)return await zt.generateDPoPProof({url:t,accessToken:n==null?void 0:n.access_token,httpMethod:r,keyPair:a.keys,nonce:o})}async generateDPoPJkt(t){let n=await t.store.get(this.settings.client_id);if(!n){const r=await zt.generateDPoPKeys();n=new fI(r),await t.store.set(this.settings.client_id,n)}return await zt.generateDPoPJkt(n.keys)}};const _I="OAUTH2_LOGIN_FLOW_COMPLETE_EVENT",bI="OAUTH_GET_TOP_URL",yv="OAUTH_REDIRECT_TOP_WINDOW",EI="OAUTH_UPDATE_URL",SI="OAUTH2_CHECK_PENDING",Jc="oauth2_top_origin",La="oauth2_login_success",Xc="oauth2_state",wv=60,U9=Math.max(wv-15,20),j9=sv("oidc-auth",{color:"green"}),ff=e=>j9.extend(e);sv("oidc-auth-utils");const TI=()=>typeof window>"u"?"":new URLSearchParams(window.location.search).get("origin")||"",vo=(Oo=class{constructor(){Ce(this,"settings",null)}static getInstance(){return Oo.instance||(Oo.instance=new Oo),Oo.instance}configure(t){this.settings=t}isConfigured(){return this.settings!==null}getSettings(){if(!this.settings)throw new Error("OidcAuthConfig not configured. Call configure() or pass settings to OidcAuthClient.initialize().");return this.settings}getAuthOrigin(){const{authOrigin:t,authEndpoint:n}=this.getSettings();return t||new URL(n).origin}isAccessTokenProactiveRefreshEnabled(){var t;return((t=this.settings)==null?void 0:t.accessTokenProactiveRefreshEnabled)??!0}getOidcSettings(){const t=typeof window>"u"?"":window.location.origin,{clientId:n,authEndpoint:r}=this.getSettings(),o=this.getAuthOrigin(),i=typeof window<"u"?new mv({store:window.localStorage}):void 0,{accessTokenExpiringNotificationTimeInSeconds:s=wv}=this.getSettings();return{client_id:n,authority:o,redirect_uri:`${t}/login/oauth-callback`,post_logout_redirect_uri:t,response_type:"code",scope:"openid offline_access",automaticSilentRenew:!1,accessTokenExpiringNotificationTimeInSeconds:s,stateStore:i,userStore:i,metadata:{issuer:o,authorization_endpoint:r,token_endpoint:`${o}/connect/api/v1/oauth2/token`,end_session_endpoint:`${o}/logout/`}}}getAccessTokenExpiringNotificationTimeInSeconds(){return this.getSettings().accessTokenExpiringNotificationTimeInSeconds??wv}getAccessTokenFreshnessThresholdInSeconds(){return this.getSettings().accessTokenFreshnessThresholdInSeconds??U9}getAllowedParentOrigins(){var t;return(t=this.settings)==null?void 0:t.allowedParentOrigins}},Ce(Oo,"instance",null),Oo).getInstance(),W9=ff("oidc-auth:host-api"),Qc=async e=>new Promise((t,n)=>{const r=new MessageChannel;let o=!1;const i=()=>{o=!0,r.port1.close()},s=setTimeout(()=>{o||(i(),n(new Error(`Host message timeout: ${e.type}`)))},1e4);r.port1.onmessage=l=>{clearTimeout(s),i(),l.data.status!=="success"?n(l.data.payload):t(l.data.payload)};const a=new URLSearchParams(window.location.search).get("origin")||"";if(!function(l){if(!l.startsWith("http://")&&!l.startsWith("https://"))return!1;const c=vo.getAllowedParentOrigins();return!c||c.length===0||c.includes(l)}(a))return clearTimeout(s),i(),void n(new Error("Origin not allowed"));W9.log("posting message to host",e),window.top.postMessage({type:e.type,payload:e.payload,...e.data||{}},a,[r.port2])}),F9=ff("oidc-auth:OidcAuthTimer");let z9=class{constructor(){Ce(this,"timerHandle",null);Ce(this,"expiration",null);Ce(this,"initialized",!1);Ce(this,"callback",()=>{});this.timerHandle=null}init(t,n,r){const o=t-this.getEpochTime(),i=Math.max(o-n,10);this.cancel(),this.expiration=i,this.callback=r,F9.debug("OIDC: timer - using expiration",i,o,n,t,o-n),this.timerHandle=setTimeout(this.callback,1e3*i),this.initialized=!0}cancel(){this.timerHandle&&(clearTimeout(this.timerHandle),this.timerHandle=null),this.expiration=null}getEpochTime(){return Math.floor(Date.now()/1e3)}isInitialized(){return this.initialized}};const Ve=ff("oidc-auth:OidcAuthClient"),ea=class ea{constructor(){Ce(this,"userManager",null);Ce(this,"initialized",!1);Ce(this,"accessTokenExpiringTimer",null);Ce(this,"retryTimers",new Set)}static getInstance(){return ea.instance||(ea.instance=new ea),ea.instance}isInitialized(){return this.initialized}ensureInitialized(){if(!this.userManager)throw new Error("OidcAuthClient not initialized. Call initialize() first.");return this.userManager}initialize(t){if(t&&(this.initialized=!1,vo.configure(t)),this.initialized)Ve.info("OIDC: initialize() - already initialized, skipping");else if(typeof window<"u")if(vo.isConfigured())try{Ve.info("OIDC: initialize() - starting initialization");const n=vo.getOidcSettings();this.userManager=new D9(n),Es.setLogger(Ve),Es.setLevel(Es.ERROR),this.initAccessTokenExpiringTimer(),this.initialized=!0}catch(n){throw Ve.error("OIDC: initialize() - FAILED:",n),n}else Ve.warn("OIDC: initialize() - skipped, config not set");else Ve.warn("OidcAuthClient cannot initialize on server side")}async initAccessTokenExpiringTimer(){vo.isAccessTokenProactiveRefreshEnabled()?this.getUser().then(t=>{const n=t==null?void 0:t.expires_at;n&&(this.accessTokenExpiringTimer||(this.accessTokenExpiringTimer=new z9),this.accessTokenExpiringTimer.init(n,vo.getAccessTokenExpiringNotificationTimeInSeconds(),async()=>{Ve.info("OIDC: timer proactive refresh access token expiring timer fired",n),this.proactiveRefreshWithRetry()}))}).catch(t=>{Ve.error("OIDC: initAccessTokenExpiringTimer - FAILED:",t)}):Ve.warn("OIDC: timer - not starting, access token proactive refresh is disabled")}async getUser(){if(!this.userManager)return null;try{return await this.userManager.getUser()}catch(t){return Ve.error("OIDC: getUser - FAILED:",t),null}}async storeUser(t){await this.ensureInitialized().storeUser(t)}async getAccessToken(){const t=await this.getUser();if(!t)return Ve.info("OIDC: getAccessToken - no user found"),null;if(t.expired)try{const n=await this.signinSilent();return(n==null?void 0:n.access_token)||null}catch(n){return Ve.error("OIDC: getAccessToken - silent renew failed:",n),null}return this.isTokenFresh(t)||this.signinSilent().catch(n=>{Ve.error("OIDC: getAccessToken - background refresh failed:",n)}),t.access_token}getUserData(){if(typeof window>"u")return null;try{const t=vo.getOidcSettings(),n=`oidc.user:${t.authority}:${t.client_id}`,r=localStorage.getItem(n);if(!r)return null;const o=JSON.parse(r),i=o==null?void 0:o.profile;return i!=null&&i.sub?(Ve.info("OIDC: USER:",{profile:i}),{id:i.sub,email:i.email||"",first_name:i.given_name,last_name:i.family_name}):null}catch(t){return Ve.error("OIDC: getUserData - FAILED:",t),null}}async isAuthenticated(){const t=await this.getUser();return t!==null&&!t.expired}async signinRedirect(t){await this.ensureInitialized().signinRedirect({state:t?{data:t}:void 0,prompt:"login"})}async signinCallback(){const t=this.ensureInitialized(),n=await t.signinCallback();if(!n)throw Ve.error("OIDC: signinCallback - FAILED: no user returned"),new Error("Signin callback failed: no user returned");return n}async signinSilent(t){return this.ensureInitialized(),typeof navigator<"u"&&navigator.locks?navigator.locks.request("oidc-token-refresh",async()=>{const n=await this.getUser();return n&&this.isTokenFresh(n,t)?n:this.doSigninSilent()}):(Ve.warn("OIDC: signinSilent - navigator.locks not available, proceeding without lock"),this.doSigninSilent())}isTokenFresh(t,n){if(!t.expires_at)return!1;const r=n??vo.getAccessTokenFreshnessThresholdInSeconds(),o=Math.floor(Date.now()/1e3);return t.expires_at-o>r}async doSigninSilent(){const t=this.ensureInitialized();try{return await t.signinSilent()}catch(n){throw Ve.error("OIDC: doSigninSilent - FAILED:",n),n}}proactiveRefreshWithRetry(t=1){if(typeof document<"u"&&document.visibilityState==="hidden"){Ve.info("OIDC: tab is hidden, deferring proactive refresh until visible");const n=()=>{document.visibilityState==="visible"&&(document.removeEventListener("visibilitychange",n),this.proactiveRefreshWithRetry(t))};return void document.addEventListener("visibilitychange",n)}this.signinSilent(vo.getAccessTokenExpiringNotificationTimeInSeconds()).then(()=>{this.initAccessTokenExpiringTimer()}).catch(n=>{if(Ve.error(`OIDC: proactive refresh failed (attempt ${t}/2):`,n),t<2){const r=setTimeout(()=>{this.retryTimers.delete(r),this.proactiveRefreshWithRetry(t+1)},3e3);this.retryTimers.add(r)}else Ve.error("OIDC: proactive refresh exhausted all retries")})}async removeUser(){var n;const t=this.ensureInitialized();(n=this.accessTokenExpiringTimer)==null||n.cancel(),this.retryTimers.forEach(clearTimeout),this.retryTimers.clear(),await t.removeUser()}onUserLoaded(t){this.ensureInitialized().events.addUserLoaded(t)}offUserLoaded(t){this.ensureInitialized().events.removeUserLoaded(t)}onUserUnloaded(t){this.ensureInitialized().events.addUserUnloaded(t)}offUserUnloaded(t){this.ensureInitialized().events.removeUserUnloaded(t)}onSilentRenewError(t){this.ensureInitialized().events.addSilentRenewError(t)}offSilentRenewError(t){this.ensureInitialized().events.removeSilentRenewError(t)}onAccessTokenExpiring(t){this.ensureInitialized().events.addAccessTokenExpiring(t)}offAccessTokenExpiring(t){this.ensureInitialized().events.removeAccessTokenExpiring(t)}onAccessTokenExpired(t){this.ensureInitialized().events.addAccessTokenExpired(t)}offAccessTokenExpired(t){this.ensureInitialized().events.removeAccessTokenExpired(t)}getLogoutUrl(t,n){const r=new URL(function(o){return`${vo.getAuthOrigin()}${o.logoutPath}`}(t));return n&&r.searchParams.set("redirect_to",n),r.toString()}getWindowOriginParam(){const t=new URL(window.location.href).searchParams.get("origin");if(!t)throw new Error("iframe origin param is required");return t}async getTopUrl(){return(await Qc({type:bI})).topUrl}async isOAuthFlowPending(){try{return(await Qc({type:SI})).isPending}catch(t){return Ve.warn("OIDC: isOAuthFlowPending() - failed to check, assuming not pending:",t),!1}}async triggerLoginFlowViaParent({loginPath:t,windowPath:n}){Ve.info("OIDC: triggerLoginFlowViaParent() - starting");const r=await this.getTopUrl(),o=new URL(r).origin,i=`${o}${n}`,s=new URL(`${window.location.origin}${t}`);s.searchParams.set(Jc,o),s.searchParams.set("oauth2_top_wp_url",i),Ve.info("OIDC: triggerLoginFlowViaParent() - redirecting parent to:",s.toString()),await Qc({type:yv,payload:{url:s.toString()}})}async handleLoginFlowComplete(t,n){var s;if(!n)throw new Error("oauthUserState is required");const r=this.getWindowOriginParam(),o=n.state,i=(s=o==null?void 0:o.data)==null?void 0:s[Jc];if(r!==i)throw Ve.error("OIDC: handleLoginFlowComplete - origin mismatch:",r,"!==",i),new Error("Invalid origin in OAuth state");try{const a=new pf(n);await this.storeUser(a),this.initAccessTokenExpiringTimer(),window.dispatchEvent(new CustomEvent("oidc-auth-completed"))}catch(a){Ve.error("OIDC: handleLoginFlowComplete - FAILED to store user:",a),await this.triggerLoginFlowViaParent(t)}}async triggerLogoutViaParent(t,n=!0){const r=await this.getTopUrl(),o=new URL(r).origin,i=n?`${o}${t.windowPath}`:o;await this.removeUser();const s=this.getLogoutUrl(t,i);await Qc({type:yv,payload:{url:s}})}async cleanOAuthParamsFromUrl(){try{const t=await this.getTopUrl(),n=new URL(t);n.searchParams.delete("oauth_code"),n.searchParams.delete("oauth_state"),n.searchParams.delete("start-oauth"),n.searchParams.delete(La),n.searchParams.delete(Xc),await Qc({type:EI,payload:{url:n.toString()}})}catch(t){Ve.warn("Failed to clean OAuth params from URL:",t)}}setupLoginFlowMessageListener(t){let n=!1;const r=o=>{var s;if(((s=o.data)==null?void 0:s.type)!==_I)return;if(o.origin!==TI())return void Ve.error("OIDC: origin mismatch - expected:",TI(),"received:",o.origin);if(n)return void Ve.debug("OIDC: LOGIN_FLOW_COMPLETE already processed, ignoring duplicate");const i=o.data.payload;i!=null&&i.oauthState?(n=!0,this.handleLoginFlowComplete(t,i.oauthState).catch(a=>{Ve.error("OIDC: Failed to handle login flow complete:",a),n=!1})):Ve.warn("OIDC: LOGIN_FLOW_COMPLETE but no oauthState in payload")};return window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}}async getTokenExpirationInfo(){const t=await this.getUser();if(!t||!t.expires_at)return{expiresAt:null,expiresInSeconds:null,isExpired:!0};const n=new Date(1e3*t.expires_at),r=Date.now(),o=Math.floor((1e3*t.expires_at-r)/1e3);return{expiresAt:n,expiresInSeconds:o,isExpired:o<=0}}async forceTokenRefresh(){return Ve.info("OIDC: forceTokenRefresh() - manually triggering token refresh"),this.signinSilent()}};Ce(ea,"instance",null);let vv=ea;const B9=vv.getInstance();typeof window<"u"&&(window.oidcAuthClient=B9);const Ts=ff("oidc-auth:oidc-auth-redirect");function _v(e,t){e.postMessage({status:"success",payload:t})}function kI(e,t){e.postMessage({status:"error",payload:t})}function bv({targets:e,onSuccess:t,attempt:n=1}){var i,s,a;const r=new URLSearchParams(window.location.search);if(!r.get(La))return void Ts.warn("OIDC: No login_success param found, skipping");const o=r.get(Xc);if(o){if(!((i=e.window)!=null&&i.contentWindow)||!e.windowURL)return Ts.warn("Cannot forward OIDC state: iframe not available"),void(n<5?setTimeout(()=>{bv({targets:e,onSuccess:t,attempt:n+1})},500):Ts.error("OIDC: Failed to forward login flow after",5,"attempts - iframe never became available"));try{const l=JSON.parse(o),c=(a=(s=l.state)==null?void 0:s.data)==null?void 0:a[Jc];if(c&&c!==window.location.origin)return void Ts.error("Origin mismatch in OIDC state:",c,"vs",window.location.origin);(function(d,p){var w,v;const m=(w=p.window)==null?void 0:w.contentWindow,h=(v=p.windowURL)==null?void 0:v.origin;m&&h?m.postMessage({type:_I,payload:d},h):Ts.warn("Cannot send OIDC state: window or origin not available")})({oauthState:l},e);const u=new URL(window.location.href);u.searchParams.delete(La),u.searchParams.delete(Xc),history.replaceState({},"",u.toString()),t==null||t()}catch(l){Ts.error("Failed to parse or forward OIDC state:",l)}}else Ts.warn("OIDC login complete but no state found in URL")}const xI="angie_return_url",eu=go("referrer-redirect");function G9(e){try{return new URL(e,window.location.origin).origin===window.location.origin}catch{return!1}}function CI(){try{const e=localStorage.getItem(xI);if(!e)return null;let t;try{t=JSON.parse(e)}catch{return eu.warn("Stored redirect data is not valid JSON, returning null"),null}return t.url&&typeof t.url=="string"?G9(t.url)?t:(eu.warn("Stored redirect URL is invalid, returning null:",t.url),null):(eu.warn("Stored redirect data missing url field, returning null"),null)}catch{return eu.warn("localStorage not available"),null}}function II(){try{localStorage.removeItem(xI)}catch{eu.warn("localStorage not available")}}function PI(e,t){return t?`${e}#angie-prompt=${encodeURIComponent(t)}`:e}function H9(){const e=CI();return!!e&&(II(),window.location.href=PI(e.url,e.prompt),!0)}const Ev=go("oauth");function Sv(){const e=CI();if(e)return II(),void(window.location.href=PI(e.url,e.prompt));try{localStorage.setItem("angie_sidebar_state","open")}catch{Ev.warn("localStorage not available")}setTimeout(()=>{window.toggleAngieSidebar(!0)},500)}const RI=(e,t)=>{const n=document.getElementById(It.containerId);n&&n.setAttribute("aria-hidden",t?"false":"true"),t?e.removeAttribute("tabindex"):e.setAttribute("tabindex","-1")},AI=(e,t)=>{e.postMessage({status:"success",payload:t})},mf=()=>new Promise(e=>{document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e(null)}),hf=go("sdk");var $I;($I||($I={})).POST_MESSAGE="postMessage";const tu=go("sidebar");let Tv=!1;const Ma="open",kv="closed";function OI(){if(typeof window>"u")return 370;try{const e=window.localStorage.getItem("angie_sidebar_width");if(e){const t=parseInt(e,10);if(t>=350&&t<=590)return t}}catch{tu.warn("localStorage not available")}return 370}function nu(){return typeof window>"u"?null:localStorage.getItem("angie_sidebar_state")}function q9(e){try{localStorage.setItem("angie_sidebar_state",e)}catch{tu.warn("localStorage not available")}}function V9(e){try{localStorage.setItem("angie_sidebar_width",e.toString())}catch{tu.warn("localStorage not available")}}function NI(e){document.documentElement.style.setProperty("--angie-sidebar-width",`${e}px`)}function K9(){(function(){if(typeof window>"u")return!1;const e=new URLSearchParams(window.location.search);return e.has(La)||e.has(Xc)||e.has(Jc)})()?function(){LI(kv);try{localStorage.setItem("angie_sidebar_state",kv)}catch{tu.warn("localStorage not available")}}():LI(nu()||Ma)}function LI(e){typeof window<"u"&&window.toggleAngieSidebar&&window.toggleAngieSidebar(e===Ma,!0)}function Z9(){const e=document.getElementById(It.containerId);if(!e)return;let t=!1,n=0,r=0;e.addEventListener("mousedown",o=>{const i=e.getBoundingClientRect();(document.documentElement.dir==="rtl"?o.clientX<=i.left+4:o.clientX>=i.right-4)&&(t=!0,n=o.clientX,r=i.width,e.classList.add("angie-resizing"),document.body.style.cursor="ew-resize",document.body.style.userSelect="none",o.preventDefault(),o.stopPropagation())}),document.addEventListener("mousemove",o=>{if(!t)return;let i;i=document.documentElement.dir==="rtl"?n-o.clientX:o.clientX-n,NI(Math.max(350,Math.min(590,r+i))),o.preventDefault(),o.stopPropagation()}),document.addEventListener("mouseup",o=>{if(t){t=!1,e.classList.remove("angie-resizing"),document.body.style.cursor="",document.body.style.userSelect="";const i=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--angie-sidebar-width"),10);V9(i),Kc({type:ut.ANGIE_SIDEBAR_RESIZED,payload:{initialWidth:r,width:i}}),o.preventDefault(),o.stopPropagation()}}),NI(OI())}function MI(e){var t;e!=null&&e.skipDefaultCss||function(){if(typeof document>"u"||Tv)return;const n="angie-sidebar-styles";if(document.getElementById(n))return void(Tv=!0);const r=document.createElement("style");r.id=n,r.textContent=`/* Angie Sidebar - CSS Variables */ :root { --angie-sidebar-z-index: 1200; /* below MUI popups, elementor popups and media library modal */ --angie-sidebar-width: 330px; --angie-sidebar-transition: margin 0.3s ease-in-out, transform 0.3s ease-in-out; /* Direction-aware transform values for sidebar positioning */ --angie-sidebar-hide-transform: translateX(-100%); /* LTR: hide to the left */ --angie-sidebar-show-transform: translateX(0); } /* RTL-specific transform values */ [dir="rtl"] { --angie-sidebar-hide-transform: translateX(100%); /* RTL: hide to the right */ } /* Respect user's motion preferences */ @media (prefers-reduced-motion: reduce) { :root { --angie-sidebar-transition: none; } } /* Apply transitions only when user is actively toggling */ body.angie-sidebar-transitioning { transition: var(--angie-sidebar-transition) !important; } body.angie-sidebar-transitioning #angie-sidebar-container { transition: var(--angie-sidebar-transition) !important; } /* Layout (default) - Push content */ @media (min-width: 768px) { body.angie-sidebar-active { padding-inline-start: var(--angie-sidebar-width) !important; } #angie-sidebar-container { position: fixed; top: 0; inset-inline-start: 0; width: var(--angie-sidebar-width); height: 100vh; z-index: var(--angie-sidebar-z-index) !important; /* below elementor popups and media library modal */ background: #FCFCFC; transform: var(--angie-sidebar-hide-transform); outline: none; overflow: hidden; /* No default transition - only when transitioning */ } /* Resize handle */ #angie-sidebar-container::after { content: ''; position: absolute; top: 0; inset-inline-end: 0; width: 4px; height: 100%; cursor: ew-resize; background: transparent; z-index: 1000001; } /* Pink border during resize */ #angie-sidebar-container.angie-resizing { border-inline-end-color: #ff69b4 !important; border-inline-end-width: 2px !important; } /* Disable iframe pointer events during resize */ #angie-sidebar-container.angie-resizing iframe#angie-iframe { pointer-events: none !important; } } /* Active states */ body.angie-sidebar-active #angie-sidebar-container { transform: var(--angie-sidebar-show-transform); } /* Studio mode - sidebar takes full width */ @media (min-width: 768px) { html.angie-studio-active body.angie-sidebar-active #angie-sidebar-container { width: 100%; } } /* High contrast mode support */ @media (prefers-contrast: high) { #angie-sidebar-container { border-color: #000; box-shadow: none; } } /* Screen reader only class */ .angie-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } /* Plugin conflict resolution */ body.angie-sidebar-active { /* Reset common conflicting styles */ box-sizing: border-box !important; position: relative !important; } #angie-sidebar-toggle { z-index: 99999 !important; } `;const o=document.head||document.getElementsByTagName("head")[0];o.insertBefore(r,o.firstChild),Tv=!0}(),typeof window<"u"&&(window.toggleAngieSidebar=(t=e==null?void 0:e.onToggle,function(n,r){const o=document.body,i=document.getElementById(It.containerId);if(!i)return void tu.warn("Required elements not found!");const s=o.classList.contains("angie-sidebar-active"),a=n!==void 0?n:!s;r||(o.classList.add("angie-sidebar-transitioning"),setTimeout(function(){o.classList.remove("angie-sidebar-transitioning")},300)),a?o.classList.add("angie-sidebar-active"):o.classList.remove("angie-sidebar-active"),a&&setTimeout(function(){Kc({type:"focusInput"})},r?0:300),t&&t(a,i,r),q9(a?Ma:kv);const l=new CustomEvent("angieSidebarToggle",{detail:{isOpen:a,sidebar:i,skipTransition:r}});document.dispatchEvent(l),Kc({type:ut.ANGIE_SIDEBAR_TOGGLED,payload:{state:a?"opened":"closed"}})}),window.addEventListener("message",function(n){if(n.data&&n.data.type==="toggleAngieSidebar"){const{force:r,skipTransition:o}=n.data.payload||{};window.toggleAngieSidebar&&window.toggleAngieSidebar(r,o)}}))}const Er=go("iframe"),Y9=e=>{if(e.includes("://")||e.startsWith("//"))return!1;try{const t="https://test.com";return new URL(e,t).origin===t}catch{return!1}},DI=async()=>{var e;if((e=It.iframe)!=null&&e.contentWindow&&It.iframeUrlObject)try{Er.log("Disabling navigation prevention in Angie iframe"),It.iframe.contentWindow.postMessage({type:ut.ANGIE_DISABLE_NAVIGATION_PREVENTION},It.iframeUrlObject.origin),await new Promise(t=>setTimeout(t,100))}catch(t){throw Er.error("Failed to disable navigation prevention:",t),t}else Er.warn("Cannot disable navigation prevention: iframe or origin not available")},J9=async e=>{var o;if(window.screen.availWidth<=768)return void Er.log("Mobile detected, skipping iframe injection");let t=document.getElementById(It.containerId);if(!t){const i=performance.now();if(Er.log("⏱️ Waiting for sidebar container..."),await new Promise(s=>{let a=0;const l=setInterval(()=>{t=document.getElementById(It.containerId),a++,(t||a>20)&&(clearInterval(l),t&&s())},100);setTimeout(()=>{if(clearInterval(l),t)return void s();const c=new MutationObserver(()=>{t=document.getElementById(It.containerId),t&&(c.disconnect(),s())});c.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>{c.disconnect(),s()},8e3)},2e3)}),Er.log(`⏱️ Sidebar container detection took: ${(performance.now()-i).toFixed(2)}ms`),!t)return void Er.error("Sidebar container not found")}const{iframe:n,iframeUrlObject:r}=await(async i=>{const s=i.origin,a=new URL(i.path,s),l=a.pathname.slice(1).replace(/\//,"--")+"-"+Math.random().toString(36).substring(7);return new Promise(c=>{const u=new URL(s);u.pathname=a.pathname;const d=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(u.searchParams.append("colorScheme",i.uiTheme||d||"light"),u.searchParams.append("sdkVersion",i.sdkVersion),u.searchParams.append("instanceId",l),u.searchParams.append("origin",window.location.origin),i.isRTL&&u.searchParams.append("isRTL",i.isRTL?"true":"false"),window.location.hostname==="localhost"&&window.location.search.includes("debug_error")){const w=new URLSearchParams(window.location.search).get("debug_error");w&&u.searchParams.append("debug_error",w)}a.searchParams.forEach((w,v)=>{u.searchParams.set(v,w)}),u.searchParams.set("ver",new Date().getTime().toString());const p=i.parent||document,m=p.createElement("iframe"),h={"background-color":"transparent","color-scheme":"normal",...i.css};window.addEventListener("message",async w=>{var v;if(w.origin===u.origin)switch(w.data.type){case Oa.ANGIE_READY:c({iframe:m,iframeUrlObject:u});break;case Oa.ANGIE_LOADED:(v=m.contentWindow)==null||v.postMessage({type:Oa.HOST_READY,instanceId:l},u.origin)}}),m.setAttribute("src",u.href),m.id="angie-iframe",m.setAttribute("frameborder","0"),m.setAttribute("scrolling","no"),m.setAttribute("style",Object.entries(h).map(([w,v])=>`${w}: ${v}`).join("; ")),m.setAttribute("allow","clipboard-write; clipboard-read"),i.insertCallback?i.insertCallback(m):p.body.appendChild(m)})})({origin:e.origin||"https://angie.elementor.com",path:e.path&&Y9(e.path)?e.path:"angie/wp-admin",insertCallback:i=>{Er.log("Injecting Angie iframe into sidebar container"),i.setAttribute("title","Angie AI Assistant"),i.setAttribute("role","application"),i.setAttribute("aria-label","Angie AI Assistant Interface");const s=document.getElementById("angie-sidebar-loading");s&&(s.textContent=""),t==null||t.appendChild(i),RI(i,!0),i.addEventListener("load",()=>{i.focus()})},css:{width:"100%",height:"100%",border:"none",outline:"none"},uiTheme:e.uiTheme,isRTL:e.isRTL,sdkVersion:"1.4.6"});It.iframe=n,It.iframeUrlObject=r,window.addEventListener("message",i=>{var s;if(i.origin===((s=It.iframeUrlObject)==null?void 0:s.origin))switch(i.data.type){case $a.SET:window.localStorage.setItem(i.data.key,i.data.value);break;case $a.GET:{const a=i.ports[0],l=window.localStorage.getItem(i.data.key);a.postMessage({value:l});break}}}),(i=>{window.addEventListener("message",async s=>{var c,u,d,p,m,h,w;const a=s.origin===window.location.origin,l=s.origin===((c=i.iframeUrlObject)==null?void 0:c.origin);if(a||l)switch((u=s==null?void 0:s.data)==null?void 0:u.type){case ut.SDK_ANGIE_ALL_SERVERS_REGISTERED:break;case ut.SDK_ANGIE_READY_PING:{const v=s.ports[0];hf.log("Angie is ready",s),AI(v,{message:"Angie is ready"});break}case ut.SDK_REQUEST_CLIENT_CREATION:{const v=s.data.payload;try{const f=s.ports[0],g=new MessageChannel;g.port1.onmessage=_=>{f.postMessage({success:!0,data:_.data})};const y={type:ut.SDK_REQUEST_CLIENT_CREATION,payload:{success:!0,...v,clientId:`dynamic-client-${v.serverName}-${v.serverVersion}-${Date.now()}`,requestId:s.data.payload.requestId},timestamp:Date.now()};if(!i.iframe)throw new Error("Iframe not found");(p=i.iframe.contentWindow)==null||p.postMessage(y,((d=i.iframeUrlObject)==null?void 0:d.origin)||"",[g.port2])}catch(f){hf.error(`Failed to create client for SDK server "${v.serverName}":`,f)}break}case ut.SDK_TRIGGER_ANGIE:hf.log("SDK Trigger Angie received",s.data);try{const{requestId:v,prompt:f,context:g,options:y}=s.data.payload;if(!i.iframe)throw new Error("Iframe not found");(h=i.iframe.contentWindow)==null||h.postMessage({type:ut.SDK_TRIGGER_ANGIE,payload:{requestId:v,prompt:f,context:g,options:y}},((m=i.iframeUrlObject)==null?void 0:m.origin)||""),window.postMessage({type:ut.SDK_TRIGGER_ANGIE_RESPONSE,payload:{success:!0,requestId:v,response:"Angie triggered successfully"}},window.location.origin)}catch(v){hf.error("Failed to trigger Angie:",v),window.postMessage({type:ut.SDK_TRIGGER_ANGIE_RESPONSE,payload:{success:!1,requestId:(w=s.data.payload)==null?void 0:w.requestId,error:v instanceof Error?v.message:"Unknown error"}},window.location.origin)}}})})(It),function({trustedOrigin:i,onOAuthParamsCleared:s}){window.addEventListener("message",a=>{var c;if(a.origin!==i)return;const l=(c=a.ports)==null?void 0:c[0];switch(a.data.type){case bI:if(!l)return;_v(l,{topUrl:window.location.href});break;case yv:window.location.href=a.data.payload.url;break;case EI:{if(!l)return;const u=a.data.payload.url;if(!(history!=null&&history.replaceState))return void kI(l,{message:"URL update not supported in this browser"});try{const d=window.location.href;history.replaceState({},"",u),function(p,m){const h=new URL(p).searchParams,w=new URL(m).searchParams,v=[La,Xc,Jc];return v.some(f=>h.has(f))&&!v.some(f=>w.has(f))}(d,u)&&(s==null||s()),_v(l,{message:"URL updated successfully"})}catch(d){kI(l,{message:"URL update failed: "+(d instanceof Error?d.message:"Unknown error")})}break}case SI:if(!l)return;_v(l,{isPending:new URLSearchParams(window.location.search).get(La)==="true"})}})}({trustedOrigin:((o=It.iframeUrlObject)==null?void 0:o.origin)??"",onOAuthParamsCleared:Sv}),(()=>{const i={window:It.iframe,windowURL:It.iframeUrlObject};window.addEventListener("load",()=>{Ev.log("OIDC: Window load event fired, forwarding OIDC state if present"),bv({targets:i,onSuccess:Sv})}),bv({targets:i,onSuccess:Sv})})(),new URLSearchParams(window.location.search).has("start-oauth")&&(Ev.log("Post-consent flow detected, checking for referrer redirect"),H9()),window.addEventListener("message",async i=>{var s,a,l,c,u;if([window.location.origin,e.origin||"https://angie.elementor.com"].includes(i.origin))if(((s=i==null?void 0:i.data)==null?void 0:s.type)===ut.ANGIE_CHAT_TOGGLE)It.open=i.data.open,It.iframe&&RI(It.iframe,It.open);else if(((a=i==null?void 0:i.data)==null?void 0:a.type)===ut.ANGIE_STUDIO_TOGGLE){const d=i.data.isStudioOpen;if(!It.iframe)return;if(d)document.documentElement.classList.add("angie-studio-active");else{const p=OI();document.documentElement.style.setProperty("--angie-sidebar-width",`${p}px`),document.documentElement.classList.remove("angie-studio-active")}}else if(((l=i==null?void 0:i.data)==null?void 0:l.type)===ut.ANGIE_NAVIGATE_TO_URL){const{url:d="",confirmed:p=!1}=i.data.payload||{};if(!p)return void Er.log("Navigation requires user confirmation");if(!((m,h=[])=>{const w=h.length===0&&typeof window<"u"?[window.location.origin]:h;if(!m.startsWith("http"))return!1;try{const v=new URL(m);return w.includes(v.origin)}catch{return!1}})(d))return void Er.error("Navigation blocked: Invalid or unsafe URL",{url:d});await DI(),window.location.assign(d)}else if(((c=i==null?void 0:i.data)==null?void 0:c.type)===ut.ANGIE_PAGE_RELOAD){const{confirmed:d=!1}=i.data.payload||{};if(!d)return void Er.log("Page reload requires user confirmation");Er.log("Page reload confirmed - disabling navigation prevention and reloading"),await DI(),setTimeout(()=>{window.location.reload()},50)}else((u=i==null?void 0:i.data)==null?void 0:u.type)===Oa.RESET_HASH&&(window.location.hash="",AI(i.ports[0],{message:"Hash reset successfully"}))})},qo=go("registration-queue");class X9{constructor(){Ce(this,"queue",[]);Ce(this,"isProcessing",!1)}add(t){const n={id:this.generateId(t),config:t,timestamp:Date.now(),status:"pending"};return this.queue.push(n),qo.log(`Added server "${t.name}" to queue`),n}getAll(){return[...this.queue]}getPending(){return this.queue.filter(t=>t.status==="pending")}updateStatus(t,n,r){const o=this.queue.find(i=>i.id===t);o&&(o.status=n,r?o.error=r:n!=="pending"&&n!=="registered"||delete o.error,qo.log(`Updated server ${t} status to ${n}`))}async processQueue(t){if(this.isProcessing)return void qo.log("Already processing queue");this.isProcessing=!0;const n=this.getPending();qo.log(`Processing ${n.length} pending registrations`);try{for(const r of n)try{await t(r),this.updateStatus(r.id,"registered")}catch(o){const i=o instanceof Error?o.message:String(o);this.updateStatus(r.id,"failed",i),qo.error(`Failed to process registration ${r.id}:`,i)}}finally{this.isProcessing=!1}}clear(){this.queue=[],qo.log("Cleared all registrations")}resetAllToPending(){if(this.isProcessing)return qo.log("Cannot reset to pending - processing in progress"),!1;const t=this.queue.filter(r=>r.status==="registered").length,n=this.queue.filter(r=>r.status==="failed").length;return this.queue.forEach(r=>{r.status!=="pending"&&(r.status="pending",delete r.error)}),qo.log(`Reset ${t+n} registrations to pending`),!0}remove(t){const n=this.queue.findIndex(r=>r.id===t);return n!==-1&&(this.queue.splice(n,1),qo.log(`Removed registration ${t}`),!0)}generateId(t){return`reg_${t.name}_${t.version}_${Date.now()}`}}const UI="angie-prompt",Q9={origin:"https://angie.elementor.com",uiTheme:"light",isRTL:!1,containerId:sI,skipDefaultCss:!1,path:"angie/wp-admin"};class jI{constructor(){Ce(this,"angieDetector");Ce(this,"clientManager");Ce(this,"logger");Ce(this,"registrationQueue");Ce(this,"isInitialized",!1);Ce(this,"instanceId");this.instanceId=Math.random().toString(36).substring(2,8),this.logger=go({instanceId:this.instanceId}),this.logger.log("Constructor called - initializing SDK"),this.angieDetector=new d9,this.registrationQueue=new X9,this.clientManager=new f9,this.logger.log("Setting up event handlers"),this.setupAngieReadyHandler(),this.setupServerInitHandler(),this.setupReRegistrationHandler(),this.logger.log("SDK initialization complete")}async loadSidebar(t){const{widgetConfig:n,...r}=t||{},o={...Q9,...r};It.containerId=o.containerId,MI({skipDefaultCss:o.skipDefaultCss}),await J9(o),n&&Kc({type:"sdk-widget-config",payload:n}),this.setupPromptHashDetection()}setupReRegistrationHandler(){window.addEventListener("message",t=>{var n;if(((n=t.data)==null?void 0:n.type)===ut.SDK_ANGIE_REFRESH_PING)if(this.logger.log("Angie refresh ping received"),this.registrationQueue.resetAllToPending()){const r=this.registrationQueue.getPending().length;this.logger.log(`Successfully reset ${r} registrations, processing queue`),this.handleAngieReady()}else this.logger.log("Skipping queue reset - processing already in progress")})}setupAngieReadyHandler(){this.angieDetector.waitForReady().then(t=>{t.isReady?this.handleAngieReady():this.logger.warn("Angie not detected - servers will remain queued")}).catch(t=>{this.logger.error("Error waiting for Angie:",t)})}async handleAngieReady(){this.logger.log("Angie is ready, processing queued registrations");try{await this.registrationQueue.processQueue(async t=>{this.logger.log(`processQueue callback called for "${t.config.name}"`),await this.processRegistration(t)}),this.isInitialized=!0,this.logger.log("Initialization complete")}catch(t){this.logger.error("Error processing registration queue:",t)}}async processRegistration(t){this.logger.log(`Processing registration for server "${t.config.name}" (ID: ${t.id})`);try{this.logger.log(`Calling clientManager.requestClientCreation for "${t.config.name}"`);const n={...t,instanceId:this.instanceId};await this.clientManager.requestClientCreation(n),this.logger.log(`Successfully registered server "${t.config.name}"`)}catch(n){throw this.logger.error(`Failed to register server "${t.config.name}":`,n),n}}registerLocalServer(t){return t.type=Aa.LOCAL,t.transport=uf.POST_MESSAGE,this.registerServer(t)}registerRemoteServer(t){return t.type=Aa.REMOTE,this.registerServer(t)}isLocalServerConfig(t){return t.type===Aa.LOCAL||!t.type&&"server"in t}isRemoteServerConfig(t){return t.type===Aa.REMOTE&&"url"in t}async registerServer(t){if(!t.type)return this.logger.warn("For a local server, please use registerLocalServer instead of registerServer"),void this.registerLocalServer(t);if(this.logger.log(`registerServer called for "${t.name}"`),!t.name)throw new Error("Server name is required");if(!t.description)throw new Error("Server description is required");if(this.isLocalServerConfig(t)&&!t.server)throw new Error("Server instance is required for local servers");this.logger.log(`Registering server "${t.name}"`);const n=this.registrationQueue.add(t);if(this.logger.log(`Added registration to queue: ${n.id}`),this.angieDetector.isReady())try{await this.processRegistration(n),this.registrationQueue.updateStatus(n.id,"registered"),this.logger.log(`Server "${t.name}" registered successfully`)}catch(r){const o=r instanceof Error?r.message:String(r);throw this.registrationQueue.updateStatus(n.id,"failed",o),r}else this.logger.log(`Server "${t.name}" queued until Angie is ready`)}getRegistrations(){return this.registrationQueue.getAll()}getPendingRegistrations(){return this.registrationQueue.getPending()}isAngieReady(){return this.angieDetector.isReady()}isReady(){return this.isInitialized}async waitForReady(){if(!(await this.angieDetector.waitForReady()).isReady)throw new Error("Angie is not available");for(;!this.isInitialized;)await new Promise(t=>setTimeout(t,100))}async triggerAngie(t){var o;if(!this.isAngieReady())throw new Error("Angie is not ready. Please wait for Angie to be available before triggering.");const n=this.generateRequestId(),r=((o=t.options)==null?void 0:o.timeout)||3e4;return new Promise((i,s)=>{const a=setTimeout(()=>{s(new Error("Angie trigger request timed out"))},r),l=u=>{var d,p,m;((d=u.data)==null?void 0:d.type)===ut.SDK_TRIGGER_ANGIE_RESPONSE&&((m=(p=u.data)==null?void 0:p.payload)==null?void 0:m.requestId)===n&&(clearTimeout(a),window.removeEventListener("message",l),i(u.data.payload))};window.addEventListener("message",l);const c={type:ut.SDK_TRIGGER_ANGIE,payload:{requestId:n,prompt:t.prompt,options:t.options,context:{pageUrl:window.location.href,pageTitle:document.title,...t.context}},timestamp:Date.now()};this.logger.log(`Triggering Angie with prompt (Request ID: ${n})`),window.postMessage(c,window.location.origin)})}destroy(){this.registrationQueue.clear(),this.logger.log("SDK destroyed")}setupServerInitHandler(){window.addEventListener("message",t=>{var n;((n=t.data)==null?void 0:n.type)===ut.SDK_REQUEST_INIT_SERVER&&(this.logger.log("Server init request received"),this.handleServerInitRequest(t))})}handleServerInitRequest(t){const{clientId:n,serverId:r,instanceId:o}=t.data.payload||{};if(n&&r)if(this.logger.log(`Server init request received - Request instanceId: ${o}, This instanceId: ${this.instanceId}`),o&&o!==this.instanceId)this.logger.log(`Ignoring server init request for different instance. Request instanceId: ${o}, this instanceId: ${this.instanceId}`);else{this.logger.log(`Handling server init request for clientId: ${n}, serverId: ${r}`);try{const i=this.registrationQueue.getAll().find(c=>c.id===r);if(!i)return void this.logger.error(`No registration found for serverId: ${r}`);if("type"in i.config&&i.config.type==="remote")return void this.logger.log("Remote server registration detected; skipping local connect");const s=t.ports[0];if(!s)return void this.logger.error("No port provided in server init request");const a=i.config.server;this.migrateInstructionsCompat(a);const l=new p9(s);a.connect(l),this.logger.log(`Server "${i.config.name}" initialized successfully`)}catch(i){this.logger.error(`Error initializing server for clientId ${n}:`,i)}}else this.logger.error("Invalid server init request - missing clientId or serverId")}migrateInstructionsCompat(t){try{const n="server"in t&&t.server?t.server:t,r=n._serverInfo,o=n._instructions;r!=null&&r.instructions&&!o&&(n._instructions=r.instructions,this.logger.log("Migrated instructions from serverInfo to serverOptions (backward compat)"))}catch{}}generateRequestId(){return`${this.instanceId}-${Date.now()}-${Math.random().toString(36).substring(2,8)}`}parseHashParams(t){const n=t.startsWith("#")?t.substring(1):t;return new URLSearchParams(n)}async handlePromptHash(){const t=window.location.hash;if(t.includes(`${UI}=`))try{const n=this.parseHashParams(t),r=n.get(UI)||"";if(!r)return void this.logger.warn("Empty prompt detected in hash");const o=n.get("angie-new-chat")==="true";this.logger.log("Detected prompt in hash:",{prompt:r,newChat:o}),await this.waitForReady();const i=await this.triggerAngie({prompt:r,context:{source:"hash-parameter",pageUrl:window.location.href,timestamp:new Date().toISOString()},options:{newChat:o}});this.logger.log("Triggered successfully from hash:",i),window.location.hash=""}catch(n){this.logger.error("Failed to trigger from hash:",n)}}setupPromptHashDetection(){this.handlePromptHash(),window.addEventListener("hashchange",()=>this.handlePromptHash())}}const WI=go("navigation"),FI=(e,t)=>{if(zn()){t.isOpen&&window.toggleAngieSidebar&&window.toggleAngieSidebar(!0);const n=Kc({type:"angie-route-navigation",path:e,payload:t});return n||WI.error("Failed to post navigation message to Angie iframe"),n}return WI.error("Angie iframe not found"),!1};var ks;(function(e){e.Inline="inline",e.EndOfTurn="end-of-turn"})(ks||(ks={}));var zI=(e=>(e.INPUT="input",e.TEXTAREA="textarea",e.SELECT="select",e.IFRAME="iframe",e))(zI||{}),BI=(e=>(e.LABEL="label",e.TABLE_HEADER="th",e.LABEL_CLASS=".label",e))(BI||{}),GI=(e=>(e.TABLE_ROW="tr",e.FORM_FIELD=".form-field",e.FORM_TABLE_ROW=".form-table tr",e))(GI||{});const eH=['input:not([type="hidden"])',"textarea","select",'iframe[id*="content_ifr"], iframe[id*="editor"]','[contenteditable="true"]'],gf="[WP Admin Fields Context]",tH={INITIAL_CONTEXT:500,EDITOR_SETUP:2e3};async function nH(e){try{let t=null;const n=h=>{const w=document.getElementById("wpbody");return!w||!w.contains(h)?!1:Object.values(zI).includes(h.tagName.toLowerCase())||h.contentEditable==="true"},r=h=>{if(h.hidden||h.style.display==="none"||h.style.visibility==="hidden"||h.offsetParent===null)return!1;const w=document.getElementById("wpbody");let v=h.parentElement;for(;v&&v!==w;){const f=window.getComputedStyle(v);if(f.display==="none"||f.visibility==="hidden"||v.hidden)return!1;v=v.parentElement}return!0},o=h=>{var v,f;let w=h.getAttribute("title")||"";if(!w&&h.id){const g=document.querySelector(`label[for="${h.id}"]`);g&&(w=((v=g.textContent)==null?void 0:v.trim().replace("Select ",""))||"")}if(!w){const g=Object.values(GI).join(", "),y=h.closest(g);if(y){const _=Object.values(BI).join(", "),E=y.querySelector(_);E&&(w=((f=E.textContent)==null?void 0:f.trim())||"")}}return w||null},i=()=>{const h=document.getElementById("wpbody");if(!h)return[];const w=[],v=eH.join(", ");h.querySelectorAll(v).forEach(y=>{const _=y,E=_,S=E.name||_.id||"unknown",k=E.type||_.tagName.toLowerCase(),C=o(_),O=r(_),U=E.disabled||_.getAttribute("disabled")==="disabled";let T="";if(E.type==="checkbox"||E.type==="radio")T=E.checked?E.value||"checked":"";else if(_.tagName.toLowerCase()==="select"){const q=_;q.multiple&&q.selectedOptions?T=Array.from(q.selectedOptions).map(K=>K.value):T=q.value||""}else _.contentEditable==="true"?T=_.textContent||"":T=E.value||_.textContent||"";const A=_.closest("tr")||_.parentElement||_,L=A==null?void 0:A.querySelector("img"),j=L!=null&&L.src?L.src.replace(/-\d+x\d+(\.[^.]+)$/i,"$1")||L.src:null;w.push({name:S,type:k,value:T,label:C,id:_.id||null,imageUrl:j,isVisible:O,isDisabled:U})});const g=document.querySelectorAll("li.attachment");return g.length>0&&g.forEach(y=>{const _=y.getAttribute("data-id"),E=y.getAttribute("aria-label")||"";if(_){const S=y.querySelector("img"),k=(S==null?void 0:S.src)||null;w.push({name:`media-${_}`,type:"media-item",value:_,label:E||`Media Item ${_}`,id:`media-${_}`,imageUrl:k,isVisible:!0,isDisabled:!1})}}),w.filter(y=>y.isVisible)},s=()=>{const h=document.getElementById("wpbody");if(!h)return[];const w=h.querySelectorAll('input[type="checkbox"]'),v=[];return w.forEach(f=>{var E;const g=f;if(!r(g)||Q3(g))return;const y=g.name||g.id||"unknown";let _=g.getAttribute("title")||"";if(!_&&g.id){const S=document.querySelector(`label[for="${g.id}"]`);S&&(_=((E=S.textContent)==null?void 0:E.trim())||"")}_||(_=y),v.push({name:y,title:_,isChecked:g.checked,id:g.id||null})}),v},a=(h,w,v)=>{var C;const f=h.name||h.id||"unknown",g=o(h),y=g||f,_=((C=Be==null?void 0:Be.general)==null?void 0:C.displayName)||"WordPress Admin",E=h.closest("tr")||h.parentElement||h,S=E==null?void 0:E.querySelector("img"),k=S!=null&&S.src?S.src.replace(/-\d+x\d+(\.[^.]+)$/i,"$1")||S.src:null;return{displayName:`${_} > ${y}`,data:{selectedField:{name:f,type:w||h.type||h.tagName.toLowerCase(),value:v||h.value||h.textContent||"",imageUrl:k,label:g,id:h.id||null,isVisible:r(h),isDisabled:h.disabled||h.getAttribute("disabled")==="disabled"},checklist:s(),allAvailableFields:i()}}},l=()=>({displayName:"",data:{selectedField:null,checklist:s(),allAvailableFields:i()}}),c=h=>{const w=JSON.stringify(h);w!==t&&(t=w,e(h).catch(v=>{console.error(`${gf} Error updating context:`,v)}))},u=(h,w,v)=>{n(h)&&c(a(h,w,v))},d=h=>{var v;if(h.target.type==="checkbox"){const f=s().filter(g=>g.isChecked);if(f.length===0)c(l());else if(f.length===1){const g=f[0],y=document.getElementById(g.id||"")||document.querySelector(`input[name="${g.name}"]`);y&&c(a(y))}else{const g=f.map(_=>_.title),y=((v=Be==null?void 0:Be.general)==null?void 0:v.displayName)||"WordPress Admin";c({displayName:`${y} > Multiple inputs`,data:{selectedField:null,selectedCount:f.length,selectedTitles:g,checklist:s(),allAvailableFields:i()}})}}},p=()=>{window.tinymce&&typeof window.tinymce.on=="function"&&window.tinymce.on("AddEditor",w=>{w.editor.on("focus",()=>u(w.editor.getElement(),"tinymce_editor",w.editor.getContent()))});const h=document.getElementById("wpbody");if(!h){console.error(`${gf} WP_BODY not found`);return}h.querySelectorAll('iframe[id*="content_ifr"], iframe[id*="editor"]').forEach(w=>{try{const v=w,f=v.contentDocument;f&&f.addEventListener("focusin",()=>{var g;return u(v,"visual_editor",(g=f.body)==null?void 0:g.innerHTML)})}catch(v){console.error(`${gf} Error setting up context listener for iframe:`,v)}})};document.addEventListener("focusin",h=>u(h.target)),document.addEventListener("change",d),c(l());const m=()=>{p()};await mf(),m(),setTimeout(m,tH.EDITOR_SETUP)}catch(t){console.error(`${gf} Error setting up context listener:`,t)}}function Qt(e,t){return t.map(n=>e.registerPrompt(n.name,{title:n.title,description:n.description},()=>({messages:[{role:"user",content:{type:"text",text:n.description}}]})))}function wn(e){const{pathname:t,search:n}=window.location;if(e.endsWith(".php"))return t.endsWith(`/${e}`)||t===e;if(e.includes("=")){const[r,...o]=e.split("="),i=o.join("="),s=new URLSearchParams(n);return i===""?s.has(r):s.get(r)===i}return n.includes(e)}function rH(e){const[t,...n]=e.split("="),r=n.join("=");if(!t||!r)return!1;const i=new URLSearchParams(window.location.search).get(t);return i!==null&&i.startsWith(r)}const oH=[{title:"Create simple product",name:"create-simple-product",description:"Create a product called [product name] priced at [price]"},{title:"Create variable product",name:"create-variable-product",description:"Create a variable product called [product name] with the following variations [list variations] each priced at [price]"},{title:"Delete product",name:"delete-product",description:"Delete the product [product name] from the store"},{title:"Add category",name:"add-product-category",description:"Create a new product category called [category name]"}],iH=[{title:"Create a product description",name:"create-product-description",description:"Create a product description"},{title:"Create a product image",name:"create-product-image",description:"Create a product image"},{title:"Add page variations",name:"add-page-variations",description:"Add page variations"},{title:"Create a description from an image",name:"description-from-image",description:"Create a description from an image"},{title:"Upload product from a file",name:"upload-product-from-file",description:"Upload product from a file"},{title:"Configure upsell",name:"configure-upsell",description:"Configure upsell"},{title:"Configure cross sell",name:"configure-cross-sell",description:"Configure cross sell"},{title:"Upload product images",name:"upload-product-images",description:"Upload product images"},{title:"Change product type",name:"change-product-type",description:"Change product type"}],Da={FETCH_EXTERNAL_IMAGE:"fetch-external-image"},Bn="wc/v3/",Ci=()=>{const{root:e,nonce:t}=window.wpApiSettings;return{root:e,nonce:t}},Sr=async(e,t={})=>{const{nonce:n}=Ci();return fetch(e,{...{credentials:"same-origin",headers:{"X-WP-Nonce":n,"Content-Type":"application/json"}},...t})},Ie="angie/requiredResources",xv="angie/modelPreferences",Ee="readOnlyHint",sH=100,HI=e=>{e.registerTool("woo-get-all-products",{description:"A product listing tool that retrieves WooCommerce products from the store. Use this when you need to get products. By default, it fetches all products, or you can specify a page number to get a specific page of results.",inputSchema:{page:M().optional().describe("Optional page number to retrieve (starts from 1). Use when you only need a specific page instead of all products")},annotations:{title:"List All WooCommerce Products",[Ee]:!0}},async t=>{try{const n=t==null?void 0:t.page,{root:r}=Ci(),o=[];let i,s;const a=n!==void 0;let l=n||1,c=!0;for(;c;){const u=new URL(`${r}${Bn}products`);u.searchParams.set("per_page",sH.toString()),u.searchParams.set("page",l.toString());const d=await Sr(u.toString());if(!d.ok)throw new Error(`Failed to get products: ${d.statusText}`);const m=(await d.json()).map(v=>({id:v.id,name:v.name,status:v.status}));o.push(...m);const h=d.headers.get("X-WP-Total"),w=d.headers.get("X-WP-TotalPages");i=h?parseInt(h,10):void 0,s=w?parseInt(w,10):void 0,a?c=!1:(c=l<(s||1),l++)}return{content:[{type:"text",text:JSON.stringify({data:o,totalItems:i,totalPages:s,...a&&{currentPage:n},fetchedAllPages:!a})}]}}catch(n){throw console.error("Error in woo-get-all-products:",n),new Error(`Error getting products: ${n instanceof Error?n.message:String(n)}`)}}),e.registerTool("woo-get-product",{description:"This tool retrieves the details of a specific WooCommerce product by its product ID. Use this when you need to get the full information about a single product, such as for editing, displaying, or processing that product. The tool will return the product's details as a JSON object.",inputSchema:{productId:M().describe("The unique numeric ID of the WooCommerce product to retrieve")},annotations:{title:"Get WooCommerce Product",[Ee]:!0}},async({productId:t})=>{try{const{root:n}=Ci(),r=await Sr(`${n}${Bn}products/${t}`);if(!r.ok)throw new Error(`Failed to get product: ${r.statusText}`);const o=await r.json();return{content:[{type:"text",text:JSON.stringify(o)}]}}catch(n){throw console.error("Error in woo-get-product:",n),new Error(`Error getting product: ${n instanceof Error?n.message:String(n)}`)}})};var qI=(e=>(e.ANGIE_MINIAPP_START="angie/miniapp/start",e))(qI||{});const VI=async e=>new Promise((t,n)=>{const r=zn();if(!r)throw new Error("Angie iframe not found");const o="https://angie.elementor.com",i=new MessageChannel;i.port1.onmessage=s=>{s.data.status==="success"?t(s.data.payload):n(new Error(s.data.payload)),i.port1.close()},r.contentWindow.postMessage({type:qI.ANGIE_MINIAPP_START,payload:{...e}},o,[i.port2])}),aH=async e=>new Promise((t,n)=>{const r=zn();if(!r)throw new Error("Angie iframe not found");const o="https://angie.elementor.com",i=new MessageChannel;i.port1.onmessage=s=>{s.data.status==="success"?t(s.data.payload):n(new Error(s.data.payload)),i.port1.close()},r.contentWindow.postMessage({type:ce.ANGIE_GET_MEDIA_BLOB,payload:{mediaUrl:e}},o,[i.port2])}),lH=e=>e.includes("storage.googleapis.com"),cH=1e4;function uH(e){if(!e.src)throw new Error("Angie iframe has no src attribute");return new URL(e.src).origin}async function Ua(e,t={}){const n=zn();if(!(n!=null&&n.contentWindow))throw new Error("Angie iframe not found");const r=uH(n),{timeoutMs:o=cH}=t;return new Promise((i,s)=>{const a=new MessageChannel;let l=!1;const c=setTimeout(()=>{l||(l=!0,a.port1.close(),s(new Error(`Timeout waiting for ${e.type} response from iframe`)))},o);a.port1.onmessage=u=>{var d,p;l||(l=!0,clearTimeout(c),((d=u.data)==null?void 0:d.status)==="success"?i(u.data.payload):s(new Error(String(((p=u.data)==null?void 0:p.payload)||`Failed: ${e.type}`))),a.port1.close())},n.contentWindow.postMessage({type:e.type,...e.payload&&{payload:e.payload}},r,[a.port2])})}const dH="blob_";function KI(e){const t=atob(e),n=new ArrayBuffer(t.length),r=new Uint8Array(n);for(let o=0;o:"/\\|?*\x00-\x1f]/g,"_").replace(/^\.+/,"").replace(/\.+$/,"").trim();if((!t||t.length===0)&&(t=`upload-${Date.now()}`),fH.test(t)||(t=`${t}${mH}`),t.length>255){const r=t.split(".").pop();t=`${t.substring(0,t.lastIndexOf(".")).substring(0,250-(r?r.length+1:0))}${r?"."+r:""}`}return t}function wH(e){return e.replace(/["\\\r\n]/g,"_")}function vH(e){var r;const t=(r=e.split(".").pop())==null?void 0:r.toLowerCase(),n={gif:"image/gif",webp:"image/webp",bmp:"image/bmp",tiff:"image/tiff",tif:"image/tiff",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png"};return t&&n[t]?n[t]:"image/png"}const ZI="Use plain HTML format (not markdown). Use standard HTML tags like

,

,
    ,
  • , etc.",YI='For Gutenberg blocks (when context.website.platform is "gutenberg"), use Gutenberg block HTML format with proper blocks like:

    Your text

    . For all other cases (Classic editor, Elementor, or any other platform), use plain HTML formatting like:

    Your text

    Heading

    • Item
    . Do NOT use markdown syntax.',ru="Use plain text (not markdown or HTML)",ou="Use plain HTML format (not markdown). Use simple HTML tags like

    , , if formatting is needed.",_H=async()=>{const e=new mt({name:"woocommerce-single-product-edit-server",version:"1.0.0",title:"WooCommerce Product Edit"});return HI(e),e.registerTool("woo-update-current-viewed-product",{description:`This tool updates the current viewed product in the product dashboard UI. Use this when you need to modify the currently viewed product (The product in the context). You can only update the following product fields: [title, description (content), excerpt, regular_price, sale_price, sku, stock, low_stock_amount, purchase_note, product_length, product_width, weight and the categories] For other product fields, tell the user to move out of the product edit page because from this page you can only update certain UI fields. IMPORTANT: If the user asks to do something that requires accessing the WooCommerce database (like creating new products, bulk operations, or advanced database queries), tell them to go to the products page instead.`,inputSchema:{productUIInputFields:te(fe({elementId:b().describe("The UI input element id taken from productUIInputFields"),productFieldNewValue:b().describe(`The new value of the input field. For content/description fields: ${ZI} For text fields like title, price, SKU: ${ru}`)})).describe("List of the UI input elements that need to update. Use the productUIInputFields parameter from the context")},annotations:{title:"Update Viewed WooCommerce Product"}},async({productUIInputFields:t})=>{var n,r,o,i;try{let s=0;const a={};for(const c of t){const{elementId:u,productFieldNewValue:d}=c;if(u==="_stock"){const m=document.getElementById("_manage_stock");m instanceof HTMLInputElement&&(m.checked=isNaN(+d)||+d>0)}let p=null;if(u==="content"?p=(r=(n=document.getElementById("content_ifr"))==null?void 0:n.contentDocument)==null?void 0:r.querySelector(`[data-id="${u}"]`):u==="excerpt"?p=(i=(o=document.getElementById("excerpt_ifr"))==null?void 0:o.contentDocument)==null?void 0:i.querySelector(`[data-id="${u}"]`):(p=document.getElementById(u),p instanceof HTMLInputElement&&p.type==="checkbox"&&(p.checked=d==="true")),!p){a[u]="Element not found";continue}p instanceof HTMLInputElement||p instanceof HTMLTextAreaElement||p instanceof HTMLSelectElement?(p.value=d,p.dispatchEvent(new Event("change",{bubbles:!0})),s++):(p.textContent=d,s++)}const l=s>0?'Suggest the following quick user replies: "Publish Changes", "Save Draft"':void 0;return{content:[{type:"text",text:JSON.stringify({successfulUpdatedCount:s,failedUpdates:Object.keys(a).length>0?a:void 0,saveChangesSuggestion:l,nextStep:s>0?"Changes made to UI fields. User should save changes to persist them to the database.":void 0})}]}}catch(s){throw console.error("Error in woo-update-current-viewed-product:",s),new Error(`Error updating page elements: ${s instanceof Error?s.message:String(s)}`)}}),e.registerTool("woo-set-product-image",{description:`Sets or removes the featured image for a WooCommerce product from an image URL. MCP server handles upload automatically. Use this for WooCommerce products only, not regular WordPress posts. Requires the product ID and optional image URL. IMPORTANT: If the user asks to do something that requires accessing the WooCommerce database (like creating new products, bulk operations, or advanced database queries), tell them to go to the products page instead.`,inputSchema:{productId:M().describe("The ID of the WooCommerce product to update (get it from postId parameter)"),imageUrl:b().describe(`The URL of the image to set as product featured image. Can be any public image URL or imageRef from ${Da.FETCH_EXTERNAL_IMAGE} - MCP server will handle upload to WordPress media library.`),filename:b().optional().describe("Custom filename for the uploaded image (defaults to extracted from URL)"),title:b().optional().describe("Title for the media library entry (defaults to filename)"),altText:b().optional().describe("Alt text for accessibility (defaults to title)")},annotations:{title:"Set WooCommerce Product Image"}},async({productId:t,imageUrl:n,filename:r,title:o,altText:i})=>{try{console.log("[WooCommerce Single Product Edit Server] woo-set-product-image",{productId:t,imageUrl:n,filename:r});const{root:s}=Ci(),l=(await Ii({imageUrl:n,filename:r||"product-image.jpg",title:o||"Product Image",altText:i||"Product Image"})).id;console.log("[WooCommerce Single Product Edit Server] Product image uploaded with ID:",l);const c={images:l?[{id:l}]:[]},u=await Sr(`${s}${Bn}products/${t}`,{method:"PUT",body:JSON.stringify(c)});if(!u.ok)throw new Error(`Failed to update product image: ${u.statusText}`);const d=await u.json();return l?{content:[{type:"text",text:`Product image (ID: ${l}) set for product "${d.name||"Untitled"}" (ID: ${t}).`}]}:{content:[{type:"text",text:`Product image removed from product "${d.name||"Untitled"}" (ID: ${t}).`}]}}catch(s){throw console.error("Error in woo-set-product-image:",s),new Error(`Error setting product image for product ${t}: ${s instanceof Error?s.message:String(s)}`)}}),Qt(e,iH),e};function bH(e){let t=null;function n(){var i,s,a;const o=Number(new URLSearchParams(location.search).get("post"));o&&((a=(s=(i=window.angieConfig)==null?void 0:i.plugins)==null?void 0:s.woocommerce)!=null&&a.isSingleProductEdit)?t={currentlyViewedProductId:o,productUIInputFields:EH()}:t=null,e(t)}function r(){const o=history.pushState,i=history.replaceState;history.pushState=function(s,a,l){o.call(history,s,a,l),n()},history.replaceState=function(s,a,l){i.call(history,s,a,l),n()}}n(),r()}const EH=()=>{try{const e=["title","_regular_price","_sale_price","_sku","_stock","_low_stock_amount","_purchase_note","product_length","product_width","_weight","product-type"],t=[{labelText:"Product description",inputName:"product_full_description",inputId:"content",inputType:"text"},{labelText:"Product short description",inputName:"product_short_description",inputId:"excerpt",inputType:"text"}],n=document.querySelectorAll("#product_cat-all input[id]"),r=Array.from(n).map(s=>s.parentElement).filter(s=>(s==null?void 0:s.tagName.toLowerCase())==="label");return[...[...Array.from(document.querySelectorAll("label[for]")),...r].map(s=>{var h,w;const a=s.getAttribute("for")||((h=s.querySelector(":scope > input"))==null?void 0:h.id),l=document.getElementById(a??""),c=Array.from(n).map(v=>v.id);if(!l||!a||!(e.includes(a)||c.includes(a)))return null;const u=l.getAttribute("name"),d=l.getAttribute("type")||l.tagName.toLowerCase(),p=d==="checkbox"?l.checked:l.value||l.textContent||"",m={labelText:((w=s.textContent)==null?void 0:w.trim())??"",inputName:u,inputId:a,inputType:d,inputValue:p,inputOptions:[]};return d==="select"?m.inputOptions=Array.from(l.options??[]).map(v=>v.value):delete m.inputOptions,m}).filter(s=>s!==null),...t]}catch(e){return console.error("Error getting current page inputs:",e),[]}};let Be=null,JI=!1;const XI="context://current";let Vo=null;const yf=(e,t)=>{if(!Vo)throw new Error("Server not initialized");return async n=>{if(JI){console.log(`[Context Server] Skipping context update for '${e}' - Angie is processing`);return}if(t&&!t()){console.log(`[Context Server] Skipping context update for '${e}' - callback condition not met`);return}if(n===null&&(Be!=null&&Be[e])){console.log(`[Context Server] Deleting context for '${e}'`),delete Be[e];return}Be={...Be,[e]:n},Vo==null||Vo.server.sendResourceUpdated({uri:XI})}};function SH(){return Vo=new mt({name:"context-server",version:"1.0.0"},{capabilities:{resources:{subscribe:!0}}}),Vo.resource("current-context",XI,{title:"Angie Current Context"},async e=>({contents:[{uri:e.href,mimeType:"application/json",text:JSON.stringify(Be)}]})),Vo.server.setRequestHandler(jy,async e=>{console.log(`[Context Server] Client subscribed to resource: ${e.params.uri}`);const t=yf("general");return kH(async n=>{const r=(Be==null?void 0:Be.general)||{};await t({...r,displayName:n})}),NH(yf("studio")),nH(yf("wp_admin_fields",CH)),$H(t),bH(yf("woocommerce",IH)),{}}),Vo.server.setRequestHandler(Wy,async e=>(console.log(`[Context Server] Client unsubscribed from resource: ${e.params.uri}`),{})),TH(),Vo}function TH(){window.addEventListener("message",e=>{var t;if(((t=e.data)==null?void 0:t.type)===ce.ANGIE_PROCESSING_STATE_CHANGE){const{isProcessing:n}=e.data.payload||{};typeof n=="boolean"&&(JI=n,console.log(`[Context Server] Angie processing state changed: ${n?"PROCESSING":"IDLE"}`))}})}function kH(e){var o,i;if(!PH())return;console.log("[Context Server] Initializing Gutenberg display name listener");let t=null,n=null;const r=async()=>{const s=RH();s!==null&&s!==t&&(t=s,await e(s))};r(),(i=(o=window.wp)==null?void 0:o.data)==null||i.subscribe(()=>{n!==null&&clearTimeout(n),n=window.setTimeout(()=>{r()},300)})}function xH(){var e,t,n;return Go()||bs()||!!((n=(t=(e=window.angieConfig)==null?void 0:e.plugins)==null?void 0:t.woocommerce)!=null&&n.isSingleProductEdit)}function CH(){return!xH()}function IH(){var e,t,n;return!!((n=(t=(e=window.angieConfig)==null?void 0:e.plugins)==null?void 0:t.woocommerce)!=null&&n.isSingleProductEdit)}function PH(){var e,t;try{return!!((t=(e=window.wp)==null?void 0:e.data)!=null&&t.select)&&!!window.wp.data.select("core/block-editor")}catch{return!1}}function RH(){try{const{blockEditorSelect:e,editorSelect:t}=AH();if(!t)return null;const n=t.getEditedPostAttribute("title"),r=(typeof n=="string"?n:null)||QI(),o=e==null?void 0:e.getSelectedBlockClientIds(),i=(o==null?void 0:o[0])||null,s=i?e==null?void 0:e.getBlock(i):null;return s?`${r} > ${LH(s)}`:r}catch(e){return console.error("[Context Server] Error computing Gutenberg display name:",e),null}}function AH(){var e,t,n,r;return{blockEditorSelect:(t=(e=window.wp)==null?void 0:e.data)==null?void 0:t.select("core/block-editor"),editorSelect:(r=(n=window.wp)==null?void 0:n.data)==null?void 0:r.select("core/editor")}}function $H(e){var p,m;const t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=new URLSearchParams(location.search).get("post"),r=n?Number(n):null,o=QI(),i=new URL(window.location.href),s=i.pathname+i.search,a=o||"WordPress Admin",l=((p=window.angieConfig)==null?void 0:p.plugins)||{},c=((m=window.angieConfig)==null?void 0:m.installedPlugins)||{},u=()=>{const h=new Date;return{gmt:h.toLocaleString(void 0,{timeZone:"UTC"}),user:h.toLocaleString(void 0,{timeZone:t,timeZoneName:"long",weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"})}},d={displayName:a,data:{today:u(),timezone:t,currentPage:{pageName:a,pageTitle:o,menuPath:OH(),pageUrl:s},plugins:l,installedPlugins:c},...r&&{postId:r}};e(d),setInterval(()=>{var w;const h={...d,displayName:((w=Be==null?void 0:Be.general)==null?void 0:w.displayName)||d.displayName,data:{...d.data,today:u()}};e(h)},6e4)}function OH(){var r,o,i;const e=document.getElementById("adminmenu");if(!e)return null;const t=[],n=e.querySelector("li.wp-has-current-submenu a .wp-menu-name");if(n){t.push(((r=n.textContent)==null?void 0:r.trim())||"");const s=n.closest("li.wp-has-current-submenu"),a=s==null?void 0:s.querySelector("ul.wp-submenu li.current a");a&&t.push(((o=a.textContent)==null?void 0:o.trim())||"")}else{const s=e.querySelector("li.current a, a.current");s&&t.push(((i=s.textContent)==null?void 0:i.trim())||"")}return t.length>0?t.join(" > ").toLowerCase():null}function NH(e){let t=null;window.addEventListener(ce.STUDIO_UI_SESSION_START,()=>{Be&&!t&&(t={...Be},Be=null),e(null)}),window.addEventListener(ce.STUDIO_UI_STATE_UPDATE,n=>{e(n.detail)}),window.addEventListener(ce.STUDIO_UI_SESSION_END,async()=>{t&&(Be={...t},t=null),await e(null)})}function QI(){var e,t,n,r,o;try{if((t=(e=window.elementor)==null?void 0:e.documents)!=null&&t.getCurrent){const s=window.elementor.documents.getCurrent(),a=(o=(r=(n=s==null?void 0:s.config)==null?void 0:n.settings)==null?void 0:r.settings)==null?void 0:o.post_title;if(a)return a}let i=document.title||"Page";return i=i.split(/\s*[‹»|–—-]\s*/)[0],i.trim()||"Page"}catch(i){return console.warn("[Context Server] Could not get page title:",i),"Page"}}function LH(e){var t,n,r,o,i;try{const s=(r=(n=(t=window.wp)==null?void 0:t.blocks)==null?void 0:n.getBlockType)==null?void 0:r.call(n,e.name);if(s!=null&&s.title)return s.title;const a=((i=(o=e==null?void 0:e.name)==null?void 0:o.split("/")[1])==null?void 0:i.replace(/-/g," "))||e.name;return a.charAt(0).toUpperCase()+a.slice(1)}catch(s){return console.warn("[Context Server] Could not get block display name:",s),"Block"}}let Cv;const MH=()=>(Cv=DH(),Cv),DH=async()=>new Promise((e,t)=>{window.elementorCommon.ajax.addRequest("ai_get_remote_config",{success:n=>{const{jwt:r,features:o=[]}=n.config;e({jwt:r,features:o})},error:n=>{console.log("remoteConfig",n),t(n)}})}),UH=(e,t)=>{e.postMessage({status:"success",payload:t})},jH=(e,t)=>{e.postMessage({status:"error",payload:t})},eP=async e=>{const t=e.origin||"https://editor-static-bucket.elementor.com",n=await Cv,r=new URL(e.path,t),o=r.pathname.slice(1).replace(/\//,"--")+"-"+Math.random().toString(36).substring(7);return new Promise(i=>{var h,w,v,f,g,y,_,E,S;const s=new URL(t);s.pathname=r.pathname,s.pathname+=".html";const a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",l=((g=(f=(v=(w=(h=window.elementor)==null?void 0:h.config)==null?void 0:w.settings)==null?void 0:v.editorPreferences)==null?void 0:f.settings)==null?void 0:g.ui_theme)||a;if(s.searchParams.append("colorScheme",l),s.searchParams.append("isRTL",(_=(y=window.elementorCommon)==null?void 0:y.config)!=null&&_.isRTL?"true":"false"),s.searchParams.append("version",(S=(E=window.elementorCommon)==null?void 0:E.config)==null?void 0:S.version),s.searchParams.append("instanceId",o),s.searchParams.append("origin",window.location.origin),window.location.hostname==="localhost"&&window.location.search.includes("debug_error")){const k=new URLSearchParams(window.location.search).get("debug_error");k&&s.searchParams.append("debug_error",k)}r.searchParams.forEach((k,C)=>{s.searchParams.set(C,k)}),s.searchParams.set("ver",new Date().getTime().toString());const c=e.parent||document,u=c.createElement("iframe");function d(k){var U,T,A,L,j,q,K,J,z,Z,W,$,G,D,x,I,F,ne,re,be;const C=window.elementor?(U=window.elementor.config)==null?void 0:U.user:(A=(T=window.elementorAdmin)==null?void 0:T.config)==null?void 0:A.user,O=(J=(j=(L=window.elementorFrontend)==null?void 0:L.elements)==null?void 0:j.$window[0])==null?void 0:J.getComputedStyle((K=(q=window.elementorFrontend)==null?void 0:q.elements)==null?void 0:K.$body[0]);(be=u.contentWindow)==null||be.postMessage({type:"referrer/info",instanceId:k,info:{page:{url:window.location.href,editorSessionId:window.EDITOR_SESSION_ID,elementorAiCurrentContext:window.elementorAiCurrentContext,bodyStyle:{backgroundColor:O==null?void 0:O.backgroundColor,backgroundImage:O==null?void 0:O.backgroundImage}},authToken:n==null?void 0:n.jwt,siteKey:e.siteKey,products:{core:{version:(Z=(z=window.elementor)==null?void 0:z.config)==null?void 0:Z.version},pro:{isPro:($=(W=window.elementor)==null?void 0:W.config)==null?void 0:$.isPro,accessLevel:(D=(G=window.elementor)==null?void 0:G.config)==null?void 0:D.accessLevel,accessTier:(I=(x=window.elementor)==null?void 0:x.config)==null?void 0:I.accessTier},ai:{config:window.ElementorAiConfig}},user:{isAdmin:(re=(ne=(F=window.elementor)==null?void 0:F.config)==null?void 0:ne.user)==null?void 0:re.is_administrator,introduction:C==null?void 0:C.introduction}}},s.origin)}const p=async k=>{if(k.origin===s.origin)switch(k.data.type){case"ai_request":const{endpoint:C,data:O,immediately:U,signal:T}=k.data.payload;Object.keys(O).length&&(O.context=window.elementorAiCurrentContext),O.editor_session_id=window.EDITOR_SESSION_ID;const A=await window.elementorCommon.ajax.addRequest(C,{success:q=>{UH(k.ports[0],q)},error:q=>{const J={error:q.error||q.responseText||q.statusText||q.message||(q.toString()==="[object Object]"?"Unknown error":q.toString())};q.extra_data&&Object.assign(J,q),jH(k.ports[0],J)},data:O},U);T&&A&&"jqXhr"in A&&T&&T.addEventListener("abort",A.jqXhr.abort);break;case"get/referrer/info":d(k.data.payload.instanceId);break;case"auth-token/refresh":const L=await MH();k.ports[0].postMessage({status:"success",payload:{jwt:L.jwt}});break;case"element-selector/loaded":i({iframe:u,iframeUrlObject:s});break;case"element-selector/close":(k.data.payload.instanceId===o||!k.data.payload.instanceId)&&(u.remove(),window.removeEventListener("message",p));break;case"delete-chat-confirmed":const j=zn();j&&j.contentWindow&&j.contentWindow.postMessage({type:"delete-chat-confirmed",payload:k.data.payload},s.origin),u.remove(),window.removeEventListener("message",p);break}},m={"background-color":"transparent","color-scheme":"normal",...e.css};window.addEventListener("message",p),u.setAttribute("src",s.href),u.id="editor-static-iframe",u.setAttribute("frameborder","0"),u.setAttribute("scrolling","no"),u.setAttribute("allow","clipboard-read; clipboard-write"),u.setAttribute("style",Object.entries(m).map(([k,C])=>`${k}: ${C}`).join("; ")),u.setAttribute("allow","clipboard-write; clipboard-read"),e.insertCallback?e.insertCallback(u):c.body.appendChild(u)})};var ja=(e=>(e.ELEMENTOR="elementor",e.GUTENBERG="gutenberg",e.WOOCOMMERCE="woocommerce",e.WP_ADMIN="wp_admin",e))(ja||{});const wf={context:{}},WH=async(e=!0)=>{if(e&&Object.keys(wf.context).length)return wf.context;try{const n=await(await fetch(window.wpApiSettings.root)).json();return wf.context={name:n.name,tagline:n.description,homeUrl:n.home},wf.context}catch(t){return console.error(t),{name:"",tagline:"",homeUrl:"",error:t}}},FH=async()=>{var t;return{...await WH(),wpVersion:(t=window.angieConfig)==null?void 0:t.wpVersion,siteLang:window.document.documentElement.lang,docTitle:window.document.title}},zH=()=>{if(bs())return ja.ELEMENTOR;if(Be!=null&&Be.woocommerce)return ja.WOOCOMMERCE;if(Go())return ja.GUTENBERG;if(Be!=null&&Be.general||Be!=null&&Be.wp_admin_fields)return ja.WP_ADMIN},BH=async()=>{const e=await FH(),t=zH()||ja.WP_ADMIN;return{...e,platform:t}};function GH({classes:e,title:t,closeContent:n="✕"}){const r=document.createElement("div");r.className=e.overlay;const o=document.createElement("div");o.className=e.container;const i=document.createElement("div");i.className=e.header;const s=document.createElement("div");s.className=e.headerLeft;const a=document.createElement("h2");a.className=e.title,a.textContent=t,s.appendChild(a);const l=document.createElement("button");l.className=e.closeButton,l.setAttribute("aria-label","Close"),l.textContent=n,i.appendChild(s),i.appendChild(l);const c=document.createElement("div");return c.className=e.body,o.appendChild(i),o.appendChild(c),r.appendChild(o),{overlay:r,container:o,header:i,headerLeft:s,closeButton:l,body:c}}function HH({overlay:e,closeButton:t,onClose:n}){t.addEventListener("click",n),e.addEventListener("click",r=>{r.target===e&&n()})}const Iv="https://prompts.elementor.com",qH=Iv+"/create/widgets-elementor/?angie=true&var=1.0.0",ht={ANGIE_MODAL_OVERLAY:"angie-modal-overlay",ANGIE_MODAL_CONTAINER:"angie-modal-container",ANGIE_MODAL_HEADER:"angie-modal-header",ANGIE_MODAL_HEADER_LEFT:"angie-modal-header-left",ANGIE_MODAL_TITLE:"angie-modal-title",ANGIE_MODAL_EXTERNAL_LINK:"angie-modal-external-link",ANGIE_MODAL_CLOSE_BUTTON:"angie-modal-close-button",ANGIE_MODAL_LOADING_OVERLAY:"angie-modal-loading-overlay",ANGIE_MODAL_SPINNER:"angie-modal-spinner",ANGIE_MODAL_IFRAME_CONTAINER:"angie-modal-iframe-container",ANGIE_MODAL_IFRAME:"angie-modal-iframe",ANGIE_MODAL_SPINNER_ANIMATION:"angie-modal-spinner-animation"},VH="iframe#angie-iframe";function KH(){if(document.getElementById("angie-prompt-library-styles"))return;const e=document.createElement("style");e.id="angie-prompt-library-styles",e.textContent=` .${ht.ANGIE_MODAL_OVERLAY} { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); z-index: 999999; display: flex; align-items: center; justify-content: center; transition: opacity 0.3s ease-in-out; } .${ht.ANGIE_MODAL_CONTAINER} { width: 90vw; height: 90vh; max-width: 1400px; background: white; border-radius: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); display: flex; flex-direction: column; overflow: hidden; } .${ht.ANGIE_MODAL_HEADER} { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; border-bottom: 1px solid #e0e0e0; background: white; } .${ht.ANGIE_MODAL_HEADER_LEFT} { display: flex; align-items: center; gap: 8px; } .${ht.ANGIE_MODAL_TITLE} { margin: 0; font-size: 16px; font-weight: 600; color: #1e1e1e; } .${ht.ANGIE_MODAL_CLOSE_BUTTON} { background: none; border: none; font-size: 20px; cursor: pointer; color: #666; padding: 4px 8px; border-radius: 4px; transition: background 0.2s; } .${ht.ANGIE_MODAL_CLOSE_BUTTON}:hover { background: #f0f0f0; } .${ht.ANGIE_MODAL_LOADING_OVERLAY} { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: white; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 2; } .${ht.ANGIE_MODAL_SPINNER} { width: 40px; height: 40px; border: 4px solid #f0f0f0; border-top: 4px solid #000; border-radius: 50%; animation: ${ht.ANGIE_MODAL_SPINNER_ANIMATION} 1s linear infinite; } .${ht.ANGIE_MODAL_IFRAME_CONTAINER} { flex: 1; width: 100%; height: 100%; position: relative; } .${ht.ANGIE_MODAL_IFRAME} { width: 100%; height: 100%; border: none; } @keyframes ${ht.ANGIE_MODAL_SPINNER_ANIMATION} { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } `,document.head.appendChild(e)}function Pv(){if(document.querySelector(`.${ht.ANGIE_MODAL_OVERLAY}`))return;KH();const{overlay:t,body:n,headerLeft:r,closeButton:o}=GH({classes:{overlay:ht.ANGIE_MODAL_OVERLAY,container:ht.ANGIE_MODAL_CONTAINER,header:ht.ANGIE_MODAL_HEADER,headerLeft:ht.ANGIE_MODAL_HEADER_LEFT,title:ht.ANGIE_MODAL_TITLE,closeButton:ht.ANGIE_MODAL_CLOSE_BUTTON,body:ht.ANGIE_MODAL_IFRAME_CONTAINER},title:"Prompt Library"}),i=document.createElement("a");i.innerHTML='',i.href=Iv,i.className=ht.ANGIE_MODAL_EXTERNAL_LINK,i.target="_blank",i.addEventListener("click",()=>{d({type:ce.ANGIE_PROMPT_LIBRARY_EXTERNAL_LINK_CLICKED})}),r.appendChild(i);const s=document.createElement("div");s.className=ht.ANGIE_MODAL_LOADING_OVERLAY;const a=document.createElement("div");a.className=ht.ANGIE_MODAL_SPINNER,s.appendChild(a);const l=document.createElement("iframe");l.src=qH,l.className=ht.ANGIE_MODAL_IFRAME,l.onload=()=>{s.remove()};let c=null;n.appendChild(l),n.appendChild(s);const u=()=>{c&&window.removeEventListener("message",c),setTimeout(()=>{t.style.opacity="0"},200),setTimeout(()=>{t.remove()},1e3)};c=p=>{p.origin===Iv&&p.data.type===ce.ANGIE_REMOTE_SEND_PROMPT_TO_ANGIE&&(d({type:ce.ANGIE_RECEIVED_PROMPT_FROM_LIBRARY,payload:{prompt:p.data.prompt}}),u())},window.addEventListener("message",c);function d(p){const m=document.querySelector(VH);if(m&&m.contentWindow){const w=new URL(m.src).origin;m.contentWindow.postMessage(p,w)}}HH({overlay:t,closeButton:o,onClose:u}),document.body.appendChild(t)}class ZH{constructor(t,n){Ce(this,"errors",[]);Ce(this,"files",[]);Ce(this,"type");this.files=t,this.type=n}validate(){if(this.validateAllTypesFiles(),this.type==="elementor-widget"&&this.validateElementorWidgetFiles(),this.errors.length>0)throw new Error(`Snippet validation failed: ${this.errors.join(` `)}`)}validateAllTypesFiles(){this.files.forEach(t=>{this.isPhpFile(t)&&!t.content.startsWith("{t.name==="main.php"&&(this.ifFileIncludes(t,"plugin_dir_url")&&this.errors.push(`"${t.name}": Elementor widget main.php must NOT use plugin_dir_url function, use angie_cs_get_snippet_asset_url instead.`),this.containsAssetsFiles()&&!this.ifFileIncludes(t,"_ASSETS_VERSION_")&&this.errors.push(`"${t.name}": Elementor widget main.php must include %_ASSETS_VERSION_% constant, use it in all enqueue/register calls.`))})}normalizeExt(t){return t.startsWith(".")?t.slice(1):t}isPhpFile(t){return this.normalizeExt(t.ext)==="php"}containsFileType(t){return this.files.some(n=>this.normalizeExt(n.ext)===t)}containsAssetsFiles(){return this.containsFileType("css")||this.containsFileType("js")}ifFileIncludes(t,n){return t.content.includes(n)}}function vf(e,t){new ZH(e,t).validate()}function YH(e){return{id:e.id??0,slug:e.slug,title:e.title,status:e.status,types:e.types,deploymentStatus:e.deploymentStatus,artifactId:e.artifactId??null,version:e.version??null,createdAt:e.createdAt??"",widgetName:e.widgetName,isOwnedByCurrentUser:e.isOwnedByCurrentUser}}const Rv="/angie/v1/snippets",tP=["test-only","changes-pending"];async function iu(e){const{type:t,deploymentStatus:n}=e||{},r=new URLSearchParams;t&&r.set("type",t),n!=null&&n.length&&r.set("deployment_status",n.join(","));const o=r.toString(),i=o?`${Rv}?${o}`:Rv,{data:s}=await B(i,"GET");return{snippets:s.snippets.map(YH),total:s.total}}async function JH(){const{snippets:e}=await iu({type:"elementor-widget",deploymentStatus:tP});return e.filter(t=>!!t.widgetName)}async function XH(){const{snippets:e}=await iu({deploymentStatus:tP});return e}async function QH(e,t){const{data:n}=await B(`/angie/v1/artifacts/${encodeURIComponent(e)}/rename`,"PATCH",{title:t});return n}async function nP(e){await B(`${Rv}/${e}/publish`,"POST")}var rP={exports:{}},_f={},oP={exports:{}},We={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var su=Symbol.for("react.element"),eq=Symbol.for("react.portal"),tq=Symbol.for("react.fragment"),nq=Symbol.for("react.strict_mode"),rq=Symbol.for("react.profiler"),oq=Symbol.for("react.provider"),iq=Symbol.for("react.context"),sq=Symbol.for("react.forward_ref"),aq=Symbol.for("react.suspense"),lq=Symbol.for("react.memo"),cq=Symbol.for("react.lazy"),iP=Symbol.iterator;function uq(e){return e===null||typeof e!="object"?null:(e=iP&&e[iP]||e["@@iterator"],typeof e=="function"?e:null)}var sP={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},aP=Object.assign,lP={};function Wa(e,t,n){this.props=e,this.context=t,this.refs=lP,this.updater=n||sP}Wa.prototype.isReactComponent={},Wa.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},Wa.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function cP(){}cP.prototype=Wa.prototype;function Av(e,t,n){this.props=e,this.context=t,this.refs=lP,this.updater=n||sP}var $v=Av.prototype=new cP;$v.constructor=Av,aP($v,Wa.prototype),$v.isPureReactComponent=!0;var uP=Array.isArray,dP=Object.prototype.hasOwnProperty,Ov={current:null},pP={key:!0,ref:!0,__self:!0,__source:!0};function fP(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)dP.call(t,r)&&!pP.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1>>1,G=z[$];if(0>>1;$o(I,W))Fo(ne,I)?(z[$]=ne,z[F]=W,$=F):(z[$]=I,z[x]=W,$=x);else if(Fo(ne,W))z[$]=ne,z[F]=W,$=F;else break e}}return Z}function o(z,Z){var W=z.sortIndex-Z.sortIndex;return W!==0?W:z.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],u=1,d=null,p=3,m=!1,h=!1,w=!1,v=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(z){for(var Z=n(c);Z!==null;){if(Z.callback===null)r(c);else if(Z.startTime<=z)r(c),Z.sortIndex=Z.expirationTime,t(l,Z);else break;Z=n(c)}}function _(z){if(w=!1,y(z),!h)if(n(l)!==null)h=!0,K(E);else{var Z=n(c);Z!==null&&J(_,Z.startTime-z)}}function E(z,Z){h=!1,w&&(w=!1,f(C),C=-1),m=!0;var W=p;try{for(y(Z),d=n(l);d!==null&&(!(d.expirationTime>Z)||z&&!T());){var $=d.callback;if(typeof $=="function"){d.callback=null,p=d.priorityLevel;var G=$(d.expirationTime<=Z);Z=e.unstable_now(),typeof G=="function"?d.callback=G:d===n(l)&&r(l),y(Z)}else r(l);d=n(l)}if(d!==null)var D=!0;else{var x=n(c);x!==null&&J(_,x.startTime-Z),D=!1}return D}finally{d=null,p=W,m=!1}}var S=!1,k=null,C=-1,O=5,U=-1;function T(){return!(e.unstable_now()-Uz||125$?(z.sortIndex=W,t(c,z),n(l)===null&&z===n(c)&&(w?(f(C),C=-1):w=!0,J(_,W-$))):(z.sortIndex=G,t(l,z),h||m||(h=!0,K(E))),z},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(z){var Z=p;return function(){var W=p;p=Z;try{return z.apply(this,arguments)}finally{p=W}}}})(vP),wP.exports=vP;var bq=wP.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Eq=P,ar=bq;function X(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Dv=Object.prototype.hasOwnProperty,Sq=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,bP={},EP={};function Tq(e){return Dv.call(EP,e)?!0:Dv.call(bP,e)?!1:Sq.test(e)?EP[e]=!0:(bP[e]=!0,!1)}function kq(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function xq(e,t,n,r){if(t===null||typeof t>"u"||kq(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function An(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var dn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){dn[e]=new An(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];dn[t]=new An(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){dn[e]=new An(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){dn[e]=new An(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){dn[e]=new An(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){dn[e]=new An(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){dn[e]=new An(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){dn[e]=new An(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){dn[e]=new An(e,5,!1,e.toLowerCase(),null,!1,!1)});var Uv=/[\-:]([a-z])/g;function jv(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Uv,jv);dn[t]=new An(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Uv,jv);dn[t]=new An(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Uv,jv);dn[t]=new An(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){dn[e]=new An(e,1,!1,e.toLowerCase(),null,!1,!1)}),dn.xlinkHref=new An("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){dn[e]=new An(e,1,!1,e.toLowerCase(),null,!0,!0)});function Wv(e,t,n,r){var o=dn.hasOwnProperty(t)?dn[t]:null;(o!==null?o.type!==0:r||!(2a||o[s]!==i[a]){var l=` `+o[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{Kv=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?cu(e):""}function Cq(e){switch(e.tag){case 5:return cu(e.type);case 16:return cu("Lazy");case 13:return cu("Suspense");case 19:return cu("SuspenseList");case 0:case 2:case 15:return e=Zv(e.type,!1),e;case 11:return e=Zv(e.type.render,!1),e;case 1:return e=Zv(e.type,!0),e;default:return""}}function Yv(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ba:return"Fragment";case za:return"Portal";case zv:return"Profiler";case Fv:return"StrictMode";case Gv:return"Suspense";case Hv:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case TP:return(e.displayName||"Context")+".Consumer";case SP:return(e._context.displayName||"Context")+".Provider";case Bv:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case qv:return t=e.displayName||null,t!==null?t:Yv(e.type)||"Memo";case Pi:t=e._payload,e=e._init;try{return Yv(e(t))}catch{}}return null}function Iq(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Yv(t);case 8:return t===Fv?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ri(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function CP(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Pq(e){var t=CP(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function kf(e){e._valueTracker||(e._valueTracker=Pq(e))}function IP(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=CP(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function xf(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Jv(e,t){var n=t.checked;return Pt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function PP(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ri(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function RP(e,t){t=t.checked,t!=null&&Wv(e,"checked",t,!1)}function Xv(e,t){RP(e,t);var n=Ri(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Qv(e,t.type,n):t.hasOwnProperty("defaultValue")&&Qv(e,t.type,Ri(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function AP(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Qv(e,t,n){(t!=="number"||xf(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var uu=Array.isArray;function Ga(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=Cf.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function du(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var pu={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Rq=["Webkit","ms","Moz","O"];Object.keys(pu).forEach(function(e){Rq.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),pu[t]=pu[e]})});function DP(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||pu.hasOwnProperty(e)&&pu[e]?(""+t).trim():t+"px"}function UP(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=DP(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var Aq=Pt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function n_(e,t){if(t){if(Aq[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(X(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(X(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(X(61))}if(t.style!=null&&typeof t.style!="object")throw Error(X(62))}}function r_(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var o_=null;function i_(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var s_=null,Ha=null,qa=null;function jP(e){if(e=Nu(e)){if(typeof s_!="function")throw Error(X(280));var t=e.stateNode;t&&(t=Yf(t),s_(e.stateNode,e.type,t))}}function WP(e){Ha?qa?qa.push(e):qa=[e]:Ha=e}function FP(){if(Ha){var e=Ha,t=qa;if(qa=Ha=null,jP(e),t)for(e=0;e>>=0,e===0?32:31-(zq(e)/Bq|0)|0}var $f=64,Of=4194304;function gu(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Nf(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=gu(a):(i&=s,i!==0&&(r=gu(i)))}else s=n&~o,s!==0?r=gu(s):i!==0&&(r=gu(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function yu(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Qr(t),e[t]=n}function Vq(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=ku),hR=" ",gR=!1;function yR(e,t){switch(e){case"keyup":return b6.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wR(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Za=!1;function S6(e,t){switch(e){case"compositionend":return wR(t);case"keypress":return t.which!==32?null:(gR=!0,hR);case"textInput":return e=t.data,e===hR&&gR?null:e;default:return null}}function T6(e,t){if(Za)return e==="compositionend"||!T_&&yR(e,t)?(e=cR(),jf=w_=Li=null,Za=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=kR(n)}}function CR(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?CR(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function IR(){for(var e=window,t=xf();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=xf(e.document)}return t}function C_(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function O6(e){var t=IR(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&CR(n.ownerDocument.documentElement,n)){if(r!==null&&C_(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=xR(n,i);var s=xR(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ya=null,I_=null,Pu=null,P_=!1;function PR(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;P_||Ya==null||Ya!==xf(r)||(r=Ya,"selectionStart"in r&&C_(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Pu&&Iu(Pu,r)||(Pu=r,r=Vf(I_,"onSelect"),0tl||(e.current=F_[tl],F_[tl]=null,tl--)}function dt(e,t){tl++,F_[tl]=e.current,e.current=t}var ji={},vn=Ui(ji),Gn=Ui(!1),Ps=ji;function nl(e,t){var n=e.type.contextTypes;if(!n)return ji;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Hn(e){return e=e.childContextTypes,e!=null}function Jf(){yt(Gn),yt(vn)}function GR(e,t,n){if(vn.current!==ji)throw Error(X(168));dt(vn,t),dt(Gn,n)}function HR(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(X(108,Iq(e)||"Unknown",o));return Pt({},n,r)}function Xf(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ji,Ps=vn.current,dt(vn,e),dt(Gn,Gn.current),!0}function qR(e,t,n){var r=e.stateNode;if(!r)throw Error(X(169));n?(e=HR(e,t,Ps),r.__reactInternalMemoizedMergedChildContext=e,yt(Gn),yt(vn),dt(vn,e)):yt(Gn),dt(Gn,n)}var Jo=null,Qf=!1,z_=!1;function VR(e){Jo===null?Jo=[e]:Jo.push(e)}function H6(e){Qf=!0,VR(e)}function Wi(){if(!z_&&Jo!==null){z_=!0;var e=0,t=et;try{var n=Jo;for(et=1;e>=s,o-=s,Xo=1<<32-Qr(t)+o|n<C?(O=k,k=null):O=k.sibling;var U=p(f,k,y[C],_);if(U===null){k===null&&(k=O);break}e&&k&&U.alternate===null&&t(f,k),g=i(U,g,C),S===null?E=U:S.sibling=U,S=U,k=O}if(C===y.length)return n(f,k),bt&&As(f,C),E;if(k===null){for(;CC?(O=k,k=null):O=k.sibling;var T=p(f,k,U.value,_);if(T===null){k===null&&(k=O);break}e&&k&&T.alternate===null&&t(f,k),g=i(T,g,C),S===null?E=T:S.sibling=T,S=T,k=O}if(U.done)return n(f,k),bt&&As(f,C),E;if(k===null){for(;!U.done;C++,U=y.next())U=d(f,U.value,_),U!==null&&(g=i(U,g,C),S===null?E=U:S.sibling=U,S=U);return bt&&As(f,C),E}for(k=r(f,k);!U.done;C++,U=y.next())U=m(k,f,C,U.value,_),U!==null&&(e&&U.alternate!==null&&k.delete(U.key===null?C:U.key),g=i(U,g,C),S===null?E=U:S.sibling=U,S=U);return e&&k.forEach(function(A){return t(f,A)}),bt&&As(f,C),E}function v(f,g,y,_){if(typeof y=="object"&&y!==null&&y.type===Ba&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Tf:e:{for(var E=y.key,S=g;S!==null;){if(S.key===E){if(E=y.type,E===Ba){if(S.tag===7){n(f,S.sibling),g=o(S,y.props.children),g.return=f,f=g;break e}}else if(S.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Pi&&QR(E)===S.type){n(f,S.sibling),g=o(S,y.props),g.ref=Lu(f,S,y),g.return=f,f=g;break e}n(f,S);break}else t(f,S);S=S.sibling}y.type===Ba?(g=js(y.props.children,f.mode,_,y.key),g.return=f,f=g):(_=Cm(y.type,y.key,y.props,null,f.mode,_),_.ref=Lu(f,g,y),_.return=f,f=_)}return s(f);case za:e:{for(S=y.key;g!==null;){if(g.key===S)if(g.tag===4&&g.stateNode.containerInfo===y.containerInfo&&g.stateNode.implementation===y.implementation){n(f,g.sibling),g=o(g,y.children||[]),g.return=f,f=g;break e}else{n(f,g);break}else t(f,g);g=g.sibling}g=jb(y,f.mode,_),g.return=f,f=g}return s(f);case Pi:return S=y._init,v(f,g,S(y._payload),_)}if(uu(y))return h(f,g,y,_);if(lu(y))return w(f,g,y,_);rm(f,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,g!==null&&g.tag===6?(n(f,g.sibling),g=o(g,y),g.return=f,f=g):(n(f,g),g=Ub(y,f.mode,_),g.return=f,f=g),s(f)):n(f,g)}return v}var sl=eA(!0),tA=eA(!1),om=Ui(null),im=null,al=null,K_=null;function Z_(){K_=al=im=null}function Y_(e){var t=om.current;yt(om),e._currentValue=t}function J_(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ll(e,t){im=e,K_=al=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(qn=!0),e.firstContext=null)}function xr(e){var t=e._currentValue;if(K_!==e)if(e={context:e,memoizedValue:t,next:null},al===null){if(im===null)throw Error(X(308));al=e,im.dependencies={lanes:0,firstContext:e}}else al=al.next=e;return t}var $s=null;function X_(e){$s===null?$s=[e]:$s.push(e)}function nA(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,X_(t)):(n.next=o.next,o.next=n),t.interleaved=n,ei(e,r)}function ei(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Fi=!1;function Q_(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function rA(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ti(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function zi(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,He&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,ei(e,n)}return o=r.interleaved,o===null?(t.next=t,X_(r)):(t.next=o.next,o.next=t),r.interleaved=t,ei(e,n)}function sm(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,f_(e,n)}}function oA(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function am(e,t,n,r){var o=e.updateQueue;Fi=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?i=c:s.next=c,s=l;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==s&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(i!==null){var d=o.baseState;s=0,u=c=l=null,a=i;do{var p=a.lane,m=a.eventTime;if((r&p)===p){u!==null&&(u=u.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var h=e,w=a;switch(p=t,m=n,w.tag){case 1:if(h=w.payload,typeof h=="function"){d=h.call(m,d,p);break e}d=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=w.payload,p=typeof h=="function"?h.call(m,d,p):h,p==null)break e;d=Pt({},d,p);break e;case 2:Fi=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,p=o.effects,p===null?o.effects=[a]:p.push(a))}else m={eventTime:m,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=m,l=d):u=u.next=m,s|=p;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;p=a,a=p.next,p.next=null,o.lastBaseUpdate=p,o.shared.pending=null}}while(!0);if(u===null&&(l=d),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=u,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Ls|=s,e.lanes=s,e.memoizedState=d}}function iA(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ob.transition;ob.transition={};try{e(!1),t()}finally{et=n,ob.transition=r}}function TA(){return Cr().memoizedState}function Z6(e,t,n){var r=qi(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},kA(e))xA(t,n);else if(n=nA(e,t,n,r),n!==null){var o=On();io(n,e,r,o),CA(n,t,r)}}function Y6(e,t,n){var r=qi(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(kA(e))xA(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,eo(a,s)){var l=t.interleaved;l===null?(o.next=o,X_(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=nA(e,t,o,r),n!==null&&(o=On(),io(n,e,r,o),CA(n,t,r))}}function kA(e){var t=e.alternate;return e===At||t!==null&&t===At}function xA(e,t){ju=um=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function CA(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,f_(e,n)}}var fm={readContext:xr,useCallback:_n,useContext:_n,useEffect:_n,useImperativeHandle:_n,useInsertionEffect:_n,useLayoutEffect:_n,useMemo:_n,useReducer:_n,useRef:_n,useState:_n,useDebugValue:_n,useDeferredValue:_n,useTransition:_n,useMutableSource:_n,useSyncExternalStore:_n,useId:_n,unstable_isNewReconciler:!1},J6={readContext:xr,useCallback:function(e,t){return So().memoizedState=[e,t===void 0?null:t],e},useContext:xr,useEffect:gA,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,dm(4194308,4,vA.bind(null,t,e),n)},useLayoutEffect:function(e,t){return dm(4194308,4,e,t)},useInsertionEffect:function(e,t){return dm(4,2,e,t)},useMemo:function(e,t){var n=So();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=So();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Z6.bind(null,At,e),[r.memoizedState,e]},useRef:function(e){var t=So();return e={current:e},t.memoizedState=e},useState:mA,useDebugValue:db,useDeferredValue:function(e){return So().memoizedState=e},useTransition:function(){var e=mA(!1),t=e[0];return e=K6.bind(null,e[1]),So().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=At,o=So();if(bt){if(n===void 0)throw Error(X(407));n=n()}else{if(n=t(),tn===null)throw Error(X(349));Ns&30||cA(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,gA(dA.bind(null,r,i,e),[e]),r.flags|=2048,zu(9,uA.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=So(),t=tn.identifierPrefix;if(bt){var n=Qo,r=Xo;n=(r&~(1<<32-Qr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Wu++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[bo]=t,e[Ou]=r,VA(e,t,!1,!1),t.stateNode=e;e:{switch(s=r_(n,r),n){case"dialog":gt("cancel",e),gt("close",e),o=r;break;case"iframe":case"object":case"embed":gt("load",e),o=r;break;case"video":case"audio":for(o=0;ofl&&(t.flags|=128,r=!0,Bu(i,!1),t.lanes=4194304)}else{if(!r)if(e=lm(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Bu(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!bt)return bn(t),null}else 2*jt()-i.renderingStartTime>fl&&n!==1073741824&&(t.flags|=128,r=!0,Bu(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=jt(),t.sibling=null,n=Rt.current,dt(Rt,r?n&1|2:n&1),t):(bn(t),null);case 22:case 23:return Lb(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?dr&1073741824&&(bn(t),t.subtreeFlags&6&&(t.flags|=8192)):bn(t),null;case 24:return null;case 25:return null}throw Error(X(156,t.tag))}function iV(e,t){switch(G_(t),t.tag){case 1:return Hn(t.type)&&Jf(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return cl(),yt(Gn),yt(vn),rb(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return tb(t),null;case 13:if(yt(Rt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(X(340));il()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return yt(Rt),null;case 4:return cl(),null;case 10:return Y_(t.type._context),null;case 22:case 23:return Lb(),null;case 24:return null;default:return null}}var ym=!1,En=!1,sV=typeof WeakSet=="function"?WeakSet:Set,ue=null;function dl(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Lt(e,t,r)}else n.current=null}function Sb(e,t,n){try{n()}catch(r){Lt(e,t,r)}}var YA=!1;function aV(e,t){if(L_=Df,e=IR(),C_(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,u=0,d=e,p=null;t:for(;;){for(var m;d!==n||o!==0&&d.nodeType!==3||(a=s+o),d!==i||r!==0&&d.nodeType!==3||(l=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(m=d.firstChild)!==null;)p=d,d=m;for(;;){if(d===e)break t;if(p===n&&++c===o&&(a=s),p===i&&++u===r&&(l=s),(m=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(M_={focusedElem:e,selectionRange:n},Df=!1,ue=t;ue!==null;)if(t=ue,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ue=e;else for(;ue!==null;){t=ue;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var w=h.memoizedProps,v=h.memoizedState,f=t.stateNode,g=f.getSnapshotBeforeUpdate(t.elementType===t.type?w:no(t.type,w),v);f.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(X(163))}}catch(_){Lt(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,ue=e;break}ue=t.return}return h=YA,YA=!1,h}function Gu(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Sb(t,n,i)}o=o.next}while(o!==r)}}function wm(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Tb(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function JA(e){var t=e.alternate;t!==null&&(e.alternate=null,JA(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[bo],delete t[Ou],delete t[W_],delete t[B6],delete t[G6])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function XA(e){return e.tag===5||e.tag===3||e.tag===4}function QA(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||XA(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function kb(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Zf));else if(r!==4&&(e=e.child,e!==null))for(kb(e,t,n),e=e.sibling;e!==null;)kb(e,t,n),e=e.sibling}function xb(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(xb(e,t,n),e=e.sibling;e!==null;)xb(e,t,n),e=e.sibling}var pn=null,ro=!1;function Bi(e,t,n){for(n=n.child;n!==null;)e$(e,t,n),n=n.sibling}function e$(e,t,n){if(_o&&typeof _o.onCommitFiberUnmount=="function")try{_o.onCommitFiberUnmount(Af,n)}catch{}switch(n.tag){case 5:En||dl(n,t);case 6:var r=pn,o=ro;pn=null,Bi(e,t,n),pn=r,ro=o,pn!==null&&(ro?(e=pn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):pn.removeChild(n.stateNode));break;case 18:pn!==null&&(ro?(e=pn,n=n.stateNode,e.nodeType===8?j_(e.parentNode,n):e.nodeType===1&&j_(e,n),Eu(e)):j_(pn,n.stateNode));break;case 4:r=pn,o=ro,pn=n.stateNode.containerInfo,ro=!0,Bi(e,t,n),pn=r,ro=o;break;case 0:case 11:case 14:case 15:if(!En&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Sb(n,t,s),o=o.next}while(o!==r)}Bi(e,t,n);break;case 1:if(!En&&(dl(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Lt(n,t,a)}Bi(e,t,n);break;case 21:Bi(e,t,n);break;case 22:n.mode&1?(En=(r=En)||n.memoizedState!==null,Bi(e,t,n),En=r):Bi(e,t,n);break;default:Bi(e,t,n)}}function t$(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new sV),t.forEach(function(r){var o=gV.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function oo(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=s),r&=~i}if(r=o,r=jt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*cV(r/1960))-r,10e?16:e,Hi===null)var r=!1;else{if(e=Hi,Hi=null,Sm=0,He&6)throw Error(X(331));var o=He;for(He|=4,ue=e.current;ue!==null;){var i=ue,s=i.child;if(ue.flags&16){var a=i.deletions;if(a!==null){for(var l=0;ljt()-Pb?Ds(e,0):Ib|=n),Kn(e,t)}function m$(e,t){t===0&&(e.mode&1?(t=Of,Of<<=1,!(Of&130023424)&&(Of=4194304)):t=1);var n=On();e=ei(e,t),e!==null&&(yu(e,t,n),Kn(e,n))}function hV(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),m$(e,n)}function gV(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(X(314))}r!==null&&r.delete(t),m$(e,n)}var h$;h$=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Gn.current)qn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return qn=!1,rV(e,t,n);qn=!!(e.flags&131072)}else qn=!1,bt&&t.flags&1048576&&KR(t,tm,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;gm(e,t),e=t.pendingProps;var o=nl(t,vn.current);ll(t,n),o=sb(null,t,r,e,o,n);var i=ab();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Hn(r)?(i=!0,Xf(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Q_(t),o.updater=mm,t.stateNode=o,o._reactInternals=t,fb(t,r,e,n),t=yb(null,t,r,!0,i,n)):(t.tag=0,bt&&i&&B_(t),$n(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(gm(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=wV(r),e=no(r,e),o){case 0:t=gb(null,t,r,e,n);break e;case 1:t=FA(null,t,r,e,n);break e;case 11:t=MA(null,t,r,e,n);break e;case 14:t=DA(null,t,r,no(r.type,e),n);break e}throw Error(X(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:no(r,o),gb(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:no(r,o),FA(e,t,r,o,n);case 3:e:{if(zA(t),e===null)throw Error(X(387));r=t.pendingProps,i=t.memoizedState,o=i.element,rA(e,t),am(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=ul(Error(X(423)),t),t=BA(e,t,r,n,o);break e}else if(r!==o){o=ul(Error(X(424)),t),t=BA(e,t,r,n,o);break e}else for(ur=Di(t.stateNode.containerInfo.firstChild),cr=t,bt=!0,to=null,n=tA(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(il(),r===o){t=ni(e,t,n);break e}$n(e,t,r,n)}t=t.child}return t;case 5:return sA(t),e===null&&q_(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,D_(r,o)?s=null:i!==null&&D_(r,i)&&(t.flags|=32),WA(e,t),$n(e,t,s,n),t.child;case 6:return e===null&&q_(t),null;case 13:return GA(e,t,n);case 4:return eb(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=sl(t,null,r,n):$n(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:no(r,o),MA(e,t,r,o,n);case 7:return $n(e,t,t.pendingProps,n),t.child;case 8:return $n(e,t,t.pendingProps.children,n),t.child;case 12:return $n(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,dt(om,r._currentValue),r._currentValue=s,i!==null)if(eo(i.value,s)){if(i.children===o.children&&!Gn.current){t=ni(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=ti(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),J_(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(X(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),J_(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}$n(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,ll(t,n),o=xr(o),r=r(o),t.flags|=1,$n(e,t,r,n),t.child;case 14:return r=t.type,o=no(r,t.pendingProps),o=no(r.type,o),DA(e,t,r,o,n);case 15:return UA(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:no(r,o),gm(e,t),t.tag=1,Hn(r)?(e=!0,Xf(t)):e=!1,ll(t,n),PA(t,r,o),fb(t,r,o,n),yb(null,t,r,!0,e,n);case 19:return qA(e,t,n);case 22:return jA(e,t,n)}throw Error(X(156,t.tag))};function g$(e,t){return ZP(e,t)}function yV(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pr(e,t,n,r){return new yV(e,t,n,r)}function Db(e){return e=e.prototype,!(!e||!e.isReactComponent)}function wV(e){if(typeof e=="function")return Db(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Bv)return 11;if(e===qv)return 14}return 2}function Ki(e,t){var n=e.alternate;return n===null?(n=Pr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Cm(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")Db(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Ba:return js(n.children,o,i,t);case Fv:s=8,o|=8;break;case zv:return e=Pr(12,n,t,o|2),e.elementType=zv,e.lanes=i,e;case Gv:return e=Pr(13,n,t,o),e.elementType=Gv,e.lanes=i,e;case Hv:return e=Pr(19,n,t,o),e.elementType=Hv,e.lanes=i,e;case kP:return Im(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case SP:s=10;break e;case TP:s=9;break e;case Bv:s=11;break e;case qv:s=14;break e;case Pi:s=16,r=null;break e}throw Error(X(130,e==null?e:typeof e,""))}return t=Pr(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function js(e,t,n,r){return e=Pr(7,e,r,t),e.lanes=n,e}function Im(e,t,n,r){return e=Pr(22,e,r,t),e.elementType=kP,e.lanes=n,e.stateNode={isHidden:!1},e}function Ub(e,t,n){return e=Pr(6,e,null,t),e.lanes=n,e}function jb(e,t,n){return t=Pr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function vV(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=p_(0),this.expirationTimes=p_(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=p_(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Wb(e,t,n,r,o,i,s,a,l){return e=new vV(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Pr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Q_(i),e}function _V(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(E$)}catch(e){console.error(e)}}E$(),yP.exports=sr;var Gb=yP.exports;const Lm=Ac(Gb);var hl,S$=Gb;hl=S$.createRoot,S$.hydrateRoot;function N(){return N=Object.assign?Object.assign.bind():function(e){for(var t=1;t{r[o]=e[o].reduce((i,s)=>{if(s){const a=t(s);a!==""&&i.push(a),n&&n[s]&&i.push(n[s])}return i},[]).join(" ")}),r}function k$(e,t){const n=N({},t);return Object.keys(e).forEach(r=>{if(r.toString().match(/^(components|slots)$/))n[r]=N({},e[r],n[r]);else if(r.toString().match(/^(componentsProps|slotProps)$/)){const o=e[r]||{},i=t[r];n[r]={},!i||!Object.keys(i)?n[r]=o:!o||!Object.keys(o)?n[r]=i:(n[r]=N({},i),Object.keys(o).forEach(s=>{n[r][s]=k$(o[s],i[s])}))}else n[r]===void 0&&(n[r]=e[r])}),n}function x$(e){const{theme:t,name:n,props:r}=e;return!t||!t.components||!t.components[n]||!t.components[n].defaultProps?r:k$(t.components[n].defaultProps,r)}function oi(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function C$(e){if(P.isValidElement(e)||!oi(e))return e;const t={};return Object.keys(e).forEach(n=>{t[n]=C$(e[n])}),t}function Ws(e,t,n={clone:!0}){const r=n.clone?N({},e):e;return oi(e)&&oi(t)&&Object.keys(t).forEach(o=>{P.isValidElement(t[o])?r[o]=t[o]:oi(t[o])&&Object.prototype.hasOwnProperty.call(e,o)&&oi(e[o])?r[o]=Ws(e[o],t[o],n):n.clone?r[o]=oi(t[o])?C$(t[o]):t[o]:r[o]=t[o]}),r}const kV=Object.freeze(Object.defineProperty({__proto__:null,default:Ws,isPlainObject:oi},Symbol.toStringTag,{value:"Module"})),xV=["values","unit","step"],CV=e=>{const t=Object.keys(e).map(n=>({key:n,val:e[n]}))||[];return t.sort((n,r)=>n.val-r.val),t.reduce((n,r)=>N({},n,{[r.key]:r.val}),{})};function I$(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n="px",step:r=5}=e,o=xe(e,xV),i=CV(t),s=Object.keys(i);function a(p){return`@media (min-width:${typeof t[p]=="number"?t[p]:p}${n})`}function l(p){return`@media (max-width:${(typeof t[p]=="number"?t[p]:p)-r/100}${n})`}function c(p,m){const h=s.indexOf(m);return`@media (min-width:${typeof t[p]=="number"?t[p]:p}${n}) and (max-width:${(h!==-1&&typeof t[s[h]]=="number"?t[s[h]]:m)-r/100}${n})`}function u(p){return s.indexOf(p)+1`@media (min-width:${Hb[e]}px)`};function so(e,t,n){const r=e.theme||{};if(Array.isArray(t)){const i=r.breakpoints||P$;return t.reduce((s,a,l)=>(s[i.up(i.keys[l])]=n(t[l]),s),{})}if(typeof t=="object"){const i=r.breakpoints||P$;return Object.keys(t).reduce((s,a)=>{if(Object.keys(i.values||Hb).indexOf(a)!==-1){const l=i.up(a);s[l]=n(t[a],a)}else{const l=a;s[l]=t[l]}return s},{})}return n(t)}function R$(e={}){var t;return((t=e.keys)==null?void 0:t.reduce((r,o)=>{const i=e.up(o);return r[i]={},r},{}))||{}}function A$(e,t){return e.reduce((n,r)=>{const o=n[r];return(!o||Object.keys(o).length===0)&&delete n[r],n},t)}function PV(e,...t){const n=R$(e),r=[n,...t].reduce((o,i)=>Ws(o,i),{});return A$(Object.keys(n),r)}function RV(e,t){if(typeof e!="object")return{};const n={},r=Object.keys(t);return Array.isArray(e)?r.forEach((o,i)=>{i{e[o]!=null&&(n[o]=!0)}),n}function qb({values:e,breakpoints:t,base:n}){const r=n||RV(e,t),o=Object.keys(r);if(o.length===0)return e;let i;return o.reduce((s,a,l)=>(Array.isArray(e)?(s[a]=e[l]!=null?e[l]:e[i],i=l):typeof e=="object"?(s[a]=e[a]!=null?e[a]:e[i],i=a):s[a]=e,s),{})}function Mm(e){let t="https://mui.com/production-error/?code="+e;for(let n=1;no&&o[i]?o[i]:null,e);if(r!=null)return r}return t.split(".").reduce((r,o)=>r&&r[o]!=null?r[o]:null,e)}function Dm(e,t,n,r=n){let o;return typeof e=="function"?o=e(n):Array.isArray(e)?o=e[n]||r:o=gl(e,n)||r,t&&(o=t(o,r,e)),o}function Wt(e){const{prop:t,cssProperty:n=e.prop,themeKey:r,transform:o}=e,i=s=>{if(s[t]==null)return null;const a=s[t],l=s.theme,c=gl(l,r)||{};return so(s,a,d=>{let p=Dm(c,o,d);return d===p&&typeof d=="string"&&(p=Dm(c,o,`${t}${d==="default"?"":Vb(d)}`,d)),n===!1?p:{[n]:p}})};return i.propTypes={},i.filterProps=[t],i}function OV(e){const t={};return n=>(t[n]===void 0&&(t[n]=e(n)),t[n])}const NV={m:"margin",p:"padding"},LV={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},$$={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},MV=OV(e=>{if(e.length>2)if($$[e])e=$$[e];else return[e];const[t,n]=e.split(""),r=NV[t],o=LV[n]||"";return Array.isArray(o)?o.map(i=>r+i):[r+o]}),Kb=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],Zb=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...Kb,...Zb];function Yu(e,t,n,r){var o;const i=(o=gl(e,t,!1))!=null?o:n;return typeof i=="number"?s=>typeof s=="string"?s:i*s:Array.isArray(i)?s=>typeof s=="string"?s:i[s]:typeof i=="function"?i:()=>{}}function Yb(e){return Yu(e,"spacing",8)}function Fs(e,t){if(typeof t=="string"||t==null)return t;const n=Math.abs(t),r=e(n);return t>=0?r:typeof r=="number"?-r:`-${r}`}function DV(e,t){return n=>e.reduce((r,o)=>(r[o]=Fs(t,n),r),{})}function UV(e,t,n,r){if(t.indexOf(n)===-1)return null;const o=MV(n),i=DV(o,r),s=e[n];return so(e,s,i)}function O$(e,t){const n=Yb(e.theme);return Object.keys(e).map(r=>UV(e,t,r,n)).reduce(Zu,{})}function Mt(e){return O$(e,Kb)}Mt.propTypes={},Mt.filterProps=Kb;function Dt(e){return O$(e,Zb)}Dt.propTypes={},Dt.filterProps=Zb;function jV(e=8){if(e.mui)return e;const t=Yb({spacing:e}),n=(...r)=>(r.length===0?[1]:r).map(i=>{const s=t(i);return typeof s=="number"?`${s}px`:s}).join(" ");return n.mui=!0,n}function Um(...e){const t=e.reduce((r,o)=>(o.filterProps.forEach(i=>{r[i]=o}),r),{}),n=r=>Object.keys(r).reduce((o,i)=>t[i]?Zu(o,t[i](r)):o,{});return n.propTypes={},n.filterProps=e.reduce((r,o)=>r.concat(o.filterProps),[]),n}function Rr(e){return typeof e!="number"?e:`${e}px solid`}function Ar(e,t){return Wt({prop:e,themeKey:"borders",transform:t})}const WV=Ar("border",Rr),FV=Ar("borderTop",Rr),zV=Ar("borderRight",Rr),BV=Ar("borderBottom",Rr),GV=Ar("borderLeft",Rr),HV=Ar("borderColor"),qV=Ar("borderTopColor"),VV=Ar("borderRightColor"),KV=Ar("borderBottomColor"),ZV=Ar("borderLeftColor"),YV=Ar("outline",Rr),JV=Ar("outlineColor"),jm=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=Yu(e.theme,"shape.borderRadius",4),n=r=>({borderRadius:Fs(t,r)});return so(e,e.borderRadius,n)}return null};jm.propTypes={},jm.filterProps=["borderRadius"],Um(WV,FV,zV,BV,GV,HV,qV,VV,KV,ZV,jm,YV,JV);const Wm=e=>{if(e.gap!==void 0&&e.gap!==null){const t=Yu(e.theme,"spacing",8),n=r=>({gap:Fs(t,r)});return so(e,e.gap,n)}return null};Wm.propTypes={},Wm.filterProps=["gap"];const Fm=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=Yu(e.theme,"spacing",8),n=r=>({columnGap:Fs(t,r)});return so(e,e.columnGap,n)}return null};Fm.propTypes={},Fm.filterProps=["columnGap"];const zm=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=Yu(e.theme,"spacing",8),n=r=>({rowGap:Fs(t,r)});return so(e,e.rowGap,n)}return null};zm.propTypes={},zm.filterProps=["rowGap"];const XV=Wt({prop:"gridColumn"}),QV=Wt({prop:"gridRow"}),e8=Wt({prop:"gridAutoFlow"}),t8=Wt({prop:"gridAutoColumns"}),n8=Wt({prop:"gridAutoRows"}),r8=Wt({prop:"gridTemplateColumns"}),o8=Wt({prop:"gridTemplateRows"}),i8=Wt({prop:"gridTemplateAreas"}),s8=Wt({prop:"gridArea"});Um(Wm,Fm,zm,XV,QV,e8,t8,n8,r8,o8,i8,s8);function yl(e,t){return t==="grey"?t:e}const a8=Wt({prop:"color",themeKey:"palette",transform:yl}),l8=Wt({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:yl}),c8=Wt({prop:"backgroundColor",themeKey:"palette",transform:yl});Um(a8,l8,c8);function pr(e){return e<=1&&e!==0?`${e*100}%`:e}const u8=Wt({prop:"width",transform:pr}),Jb=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=n=>{var r,o;const i=((r=e.theme)==null||(r=r.breakpoints)==null||(r=r.values)==null?void 0:r[n])||Hb[n];return i?((o=e.theme)==null||(o=o.breakpoints)==null?void 0:o.unit)!=="px"?{maxWidth:`${i}${e.theme.breakpoints.unit}`}:{maxWidth:i}:{maxWidth:pr(n)}};return so(e,e.maxWidth,t)}return null};Jb.filterProps=["maxWidth"];const d8=Wt({prop:"minWidth",transform:pr}),p8=Wt({prop:"height",transform:pr}),f8=Wt({prop:"maxHeight",transform:pr}),m8=Wt({prop:"minHeight",transform:pr});Wt({prop:"size",cssProperty:"width",transform:pr}),Wt({prop:"size",cssProperty:"height",transform:pr});const h8=Wt({prop:"boxSizing"});Um(u8,Jb,d8,p8,f8,m8,h8);const Ju={border:{themeKey:"borders",transform:Rr},borderTop:{themeKey:"borders",transform:Rr},borderRight:{themeKey:"borders",transform:Rr},borderBottom:{themeKey:"borders",transform:Rr},borderLeft:{themeKey:"borders",transform:Rr},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:Rr},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:jm},color:{themeKey:"palette",transform:yl},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:yl},backgroundColor:{themeKey:"palette",transform:yl},p:{style:Dt},pt:{style:Dt},pr:{style:Dt},pb:{style:Dt},pl:{style:Dt},px:{style:Dt},py:{style:Dt},padding:{style:Dt},paddingTop:{style:Dt},paddingRight:{style:Dt},paddingBottom:{style:Dt},paddingLeft:{style:Dt},paddingX:{style:Dt},paddingY:{style:Dt},paddingInline:{style:Dt},paddingInlineStart:{style:Dt},paddingInlineEnd:{style:Dt},paddingBlock:{style:Dt},paddingBlockStart:{style:Dt},paddingBlockEnd:{style:Dt},m:{style:Mt},mt:{style:Mt},mr:{style:Mt},mb:{style:Mt},ml:{style:Mt},mx:{style:Mt},my:{style:Mt},margin:{style:Mt},marginTop:{style:Mt},marginRight:{style:Mt},marginBottom:{style:Mt},marginLeft:{style:Mt},marginX:{style:Mt},marginY:{style:Mt},marginInline:{style:Mt},marginInlineStart:{style:Mt},marginInlineEnd:{style:Mt},marginBlock:{style:Mt},marginBlockStart:{style:Mt},marginBlockEnd:{style:Mt},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:Wm},rowGap:{style:zm},columnGap:{style:Fm},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:pr},maxWidth:{style:Jb},minWidth:{transform:pr},height:{transform:pr},maxHeight:{transform:pr},minHeight:{transform:pr},boxSizing:{},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function g8(...e){const t=e.reduce((r,o)=>r.concat(Object.keys(o)),[]),n=new Set(t);return e.every(r=>n.size===Object.keys(r).length)}function y8(e,t){return typeof e=="function"?e(t):e}function N$(){function e(n,r,o,i){const s={[n]:r,theme:o},a=i[n];if(!a)return{[n]:r};const{cssProperty:l=n,themeKey:c,transform:u,style:d}=a;if(r==null)return null;if(c==="typography"&&r==="inherit")return{[n]:r};const p=gl(o,c)||{};return d?d(s):so(s,r,h=>{let w=Dm(p,u,h);return h===w&&typeof h=="string"&&(w=Dm(p,u,`${n}${h==="default"?"":Vb(h)}`,h)),l===!1?w:{[l]:w}})}function t(n){var r;const{sx:o,theme:i={}}=n||{};if(!o)return null;const s=(r=i.unstable_sxConfig)!=null?r:Ju;function a(l){let c=l;if(typeof l=="function")c=l(i);else if(typeof l!="object")return l;if(!c)return null;const u=R$(i.breakpoints),d=Object.keys(u);let p=u;return Object.keys(c).forEach(m=>{const h=y8(c[m],i);if(h!=null)if(typeof h=="object")if(s[m])p=Zu(p,e(m,h,i,s));else{const w=so({theme:i},h,v=>({[m]:v}));g8(w,h)?p[m]=t({sx:h,theme:i}):p=Zu(p,w)}else p=Zu(p,e(m,h,i,s))}),A$(d,p)}return Array.isArray(o)?o.map(a):a(o)}return t}const wl=N$();wl.filterProps=["sx"];function L$(e,t){const n=this;return n.vars&&typeof n.getColorSchemeSelector=="function"?{[n.getColorSchemeSelector(e).replace(/(\[[^\]]+\])/,"*:where($1)")]:t}:n.palette.mode===e?t:{}}const w8=["breakpoints","palette","spacing","shape"];function Xu(e={},...t){const{breakpoints:n={},palette:r={},spacing:o,shape:i={}}=e,s=xe(e,w8),a=I$(n),l=jV(o);let c=Ws({breakpoints:a,direction:"ltr",components:{},palette:N({mode:"light"},r),spacing:l,shape:N({},IV,i)},s);return c.applyStyles=L$,c=t.reduce((u,d)=>Ws(u,d),c),c.unstable_sxConfig=N({},Ju,s==null?void 0:s.unstable_sxConfig),c.unstable_sx=function(d){return wl({sx:d,theme:this})},c}const v8=Object.freeze(Object.defineProperty({__proto__:null,default:Xu,private_createBreakpoints:I$,unstable_applyStyles:L$},Symbol.toStringTag,{value:"Module"}));function _8(e){if(e.sheet)return e.sheet;for(var t=0;t0?mn(_l,--Zn):0,vl--,Gt===10&&(vl=1,qm--),Gt}function fr(){return Gt=Zn2||nd(Gt)>3?"":" "}function O8(e,t){for(;--t&&fr()&&!(Gt<48||Gt>102||Gt>57&&Gt<65||Gt>70&&Gt<97););return td(e,Km()+(t<6&&xo()==32&&fr()==32))}function nE(e){for(;fr();)switch(Gt){case e:return Zn;case 34:case 39:e!==34&&e!==39&&nE(Gt);break;case 40:e===41&&nE(e);break;case 92:fr();break}return Zn}function N8(e,t){for(;fr()&&e+Gt!==57;)if(e+Gt===84&&xo()===47)break;return"/*"+td(t,Zn-1)+"*"+Gm(e===47?e:fr())}function L8(e){for(;!nd(xo());)fr();return td(e,Zn)}function M8(e){return F$(Ym("",null,null,null,[""],e=W$(e),0,[0],e))}function Ym(e,t,n,r,o,i,s,a,l){for(var c=0,u=0,d=s,p=0,m=0,h=0,w=1,v=1,f=1,g=0,y="",_=o,E=i,S=r,k=y;v;)switch(h=g,g=fr()){case 40:if(h!=108&&mn(k,d-1)==58){eE(k+=Xe(Zm(g),"&","&\f"),"&\f")!=-1&&(f=-1);break}case 34:case 39:case 91:k+=Zm(g);break;case 9:case 10:case 13:case 32:k+=$8(h);break;case 92:k+=O8(Km()-1,7);continue;case 47:switch(xo()){case 42:case 47:Hm(D8(N8(fr(),Km()),t,n),l);break;default:k+="/"}break;case 123*w:a[c++]=ko(k)*f;case 125*w:case 59:case 0:switch(g){case 0:case 125:v=0;case 59+u:f==-1&&(k=Xe(k,/\f/g,"")),m>0&&ko(k)-d&&Hm(m>32?B$(k+";",r,n,d-1):B$(Xe(k," ","")+";",r,n,d-2),l);break;case 59:k+=";";default:if(Hm(S=z$(k,t,n,c,u,o,a,y,_=[],E=[],d),i),g===123)if(u===0)Ym(k,t,S,S,_,i,d,a,E);else switch(p===99&&mn(k,3)===110?100:p){case 100:case 108:case 109:case 115:Ym(e,S,S,r&&Hm(z$(e,S,S,0,0,o,a,y,o,_=[],d),E),o,E,d,a,r?_:E);break;default:Ym(k,S,S,S,[""],E,0,a,E)}}c=u=m=0,w=f=1,y=k="",d=s;break;case 58:d=1+ko(k),m=h;default:if(w<1){if(g==123)--w;else if(g==125&&w++==0&&A8()==125)continue}switch(k+=Gm(g),g*w){case 38:f=u>0?1:(k+="\f",-1);break;case 44:a[c++]=(ko(k)-1)*f,f=1;break;case 64:xo()===45&&(k+=Zm(fr())),p=xo(),u=d=ko(y=k+=L8(Km())),g++;break;case 45:h===45&&ko(k)==2&&(w=0)}}return i}function z$(e,t,n,r,o,i,s,a,l,c,u){for(var d=o-1,p=o===0?i:[""],m=tE(p),h=0,w=0,v=0;h0?p[f]+" "+g:Xe(g,/&\f/g,p[f])))&&(l[v++]=y);return Vm(e,t,n,o===0?Xb:a,l,c,u)}function D8(e,t,n){return Vm(e,t,n,M$,Gm(R8()),Qu(e,2,-2),0)}function B$(e,t,n,r){return Vm(e,t,n,Qb,Qu(e,0,r),Qu(e,r+1,-1),r)}function bl(e,t){for(var n="",r=tE(e),o=0;o6)switch(mn(e,t+1)){case 109:if(mn(e,t+4)!==45)break;case 102:return Xe(e,/(.+:)(.+)-([^]+)/,"$1"+Je+"$2-$3$1"+Bm+(mn(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~eE(e,"stretch")?q$(Xe(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(mn(e,t+1)!==115)break;case 6444:switch(mn(e,ko(e)-3-(~eE(e,"!important")&&10))){case 107:return Xe(e,":",":"+Je)+e;case 101:return Xe(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Je+(mn(e,14)===45?"inline-":"")+"box$3$1"+Je+"$2$3$1"+Sn+"$2box$3")+e}break;case 5936:switch(mn(e,t+11)){case 114:return Je+e+Sn+Xe(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Je+e+Sn+Xe(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Je+e+Sn+Xe(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Je+e+Sn+e+e}return e}var q8=function(t,n,r,o){if(t.length>-1&&!t.return)switch(t.type){case Qb:t.return=q$(t.value,t.length);break;case D$:return bl([ed(t,{value:Xe(t.value,"@","@"+Je)})],o);case Xb:if(t.length)return P8(t.props,function(i){switch(I8(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return bl([ed(t,{props:[Xe(i,/:(read-\w+)/,":"+Bm+"$1")]})],o);case"::placeholder":return bl([ed(t,{props:[Xe(i,/:(plac\w+)/,":"+Je+"input-$1")]}),ed(t,{props:[Xe(i,/:(plac\w+)/,":"+Bm+"$1")]}),ed(t,{props:[Xe(i,/:(plac\w+)/,Sn+"input-$1")]})],o)}return""})}},V8=[q8],V$=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(w){var v=w.getAttribute("data-emotion");v.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var o=t.stylisPlugins||V8,i={},s,a=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(w){for(var v=w.getAttribute("data-emotion").split(" "),f=1;f=4;++r,o-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var o7={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},i7=/[A-Z]|^ms/g,s7=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Q$=function(t){return t.charCodeAt(1)===45},e1=function(t){return t!=null&&typeof t!="boolean"},lE=G$(function(e){return Q$(e)?e:e.replace(i7,"-$&").toLowerCase()}),t1=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(s7,function(r,o,i){return Co={name:o,styles:i,next:Co},o})}return o7[t]!==1&&!Q$(t)&&typeof n=="number"&&n!==0?n+"px":n};function rd(e,t,n){if(n==null)return"";var r=n;if(r.__emotion_styles!==void 0)return r;switch(typeof n){case"boolean":return"";case"object":{var o=n;if(o.anim===1)return Co={name:o.name,styles:o.styles,next:Co},o.name;var i=n;if(i.styles!==void 0){var s=i.next;if(s!==void 0)for(;s!==void 0;)Co={name:s.name,styles:s.styles,next:Co},s=s.next;var a=i.styles+";";return a}return a7(e,t,n)}case"function":{if(e!==void 0){var l=Co,c=n(e);return Co=l,rd(e,t,c)}break}}var u=n;if(t==null)return u;var d=t[u];return d!==void 0?d:u}function a7(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o96?y7:w7},c1=function(t,n,r){var o;if(n){var i=n.shouldForwardProp;o=t.__emotion_forwardProp&&i?function(s){return t.__emotion_forwardProp(s)&&i(s)}:i}return typeof o!="function"&&r&&(o=t.__emotion_forwardProp),o},v7=function(t){var n=t.cache,r=t.serialized,o=t.isStringTag;return sE(n,r,o),o1(function(){return aE(n,r,o)}),null},_7=function e(t,n){var r=t.__emotion_real===t,o=r&&t.__emotion_base||t,i,s;n!==void 0&&(i=n.label,s=n.target);var a=c1(t,n,r),l=a||l1(o),c=!l("as");return function(){var u=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(i!==void 0&&d.push("label:"+i+";"),u[0]==null||u[0].raw===void 0)d.push.apply(d,u);else{var p=u[0];d.push(p[0]);for(var m=u.length,h=1;h(o[1].styles.match(/^@layer\s+[^{]*$/)||(o[1].styles=`@layer mui {${o[1].styles}}`),r(...o))}return n}const pE=new Map;function S7(e){const{injectFirst:t,enableCssLayer:n,children:r}=e,o=P.useMemo(()=>{const i=`${t}-${n}`;if(typeof document=="object"&&pE.has(i))return pE.get(i);const s=E7(t,n);return pE.set(i,s),s},[t,n]);return t||n?R.jsx(c7,{value:o,children:r}):r}function T7(e){return e==null||Object.keys(e).length===0}function k7(e){const{styles:t,defaultTheme:n={}}=e,r=typeof t=="function"?o=>t(T7(o)?n:o):t;return R.jsx(m7,{styles:r})}function fE(e,t){return dE(e,t)}const u1=(e,t)=>{Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))},d1=[];function x7(e){return d1[0]=e,od(d1)}const C7=Object.freeze(Object.defineProperty({__proto__:null,GlobalStyles:k7,StyledEngineProvider:S7,ThemeContext:El,css:lh,default:fE,internal_processStyles:u1,internal_serializeStyles:x7,keyframes:Sl},Symbol.toStringTag,{value:"Module"}));function I7(e){return Object.keys(e).length===0}function mE(e=null){const t=P.useContext(El);return!t||I7(t)?e:t}const P7=Xu();function hE(e=P7){return mE(e)}function p1({props:e,name:t,defaultTheme:n,themeId:r}){let o=hE(n);return r&&(o=o[r]||o),x$({theme:o,name:t,props:e})}function ch(e){let t="https://mui.com/production-error/?code="+e;for(let n=1;n{t[n]=f1(e[n])}),t}function Zi(e,t,n={clone:!0}){const r=n.clone?N({},e):e;return Tl(e)&&Tl(t)&&Object.keys(t).forEach(o=>{P.isValidElement(t[o])?r[o]=t[o]:Tl(t[o])&&Object.prototype.hasOwnProperty.call(e,o)&&Tl(e[o])?r[o]=Zi(e[o],t[o],n):n.clone?r[o]=Tl(t[o])?f1(t[o]):t[o]:r[o]=t[o]}),r}const R7=["sx"],A7=e=>{var t,n;const r={systemProps:{},otherProps:{}},o=(t=e==null||(n=e.theme)==null?void 0:n.unstable_sxConfig)!=null?t:Ju;return Object.keys(e).forEach(i=>{o[i]?r.systemProps[i]=e[i]:r.otherProps[i]=e[i]}),r};function uh(e){const{sx:t}=e,n=xe(e,R7),{systemProps:r,otherProps:o}=A7(n);let i;return Array.isArray(t)?i=[r,...t]:typeof t=="function"?i=(...s)=>{const a=t(...s);return oi(a)?N({},r,a):r}:i=N({},r,t),N({},o,{sx:i})}const $7=Object.freeze(Object.defineProperty({__proto__:null,default:wl,extendSxProp:uh,unstable_createStyleFunctionSx:N$,unstable_defaultSxConfig:Ju},Symbol.toStringTag,{value:"Module"})),m1=e=>e,h1=(()=>{let e=m1;return{configure(t){e=t},generate(t){return e(t)},reset(){e=m1}}})(),g1={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Ot(e,t,n="Mui"){const r=g1[t];return r?`${n}-${r}`:`${h1.generate(e)}-${t}`}function O7(e,t){return N({toolbar:{minHeight:56,[e.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[e.up("sm")]:{minHeight:64}}},t)}var Ft={},y1={exports:{}};(function(e){function t(n){return n&&n.__esModule?n:{default:n}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(y1);var w1=y1.exports;const N7=wi(AV);function v1(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const L7=wi(Object.freeze(Object.defineProperty({__proto__:null,default:v1},Symbol.toStringTag,{value:"Module"})));var _1=w1;Object.defineProperty(Ft,"__esModule",{value:!0});var wt=Ft.alpha=k1;Ft.blend=K7,Ft.colorChannel=void 0;var M7=Ft.darken=yE;Ft.decomposeColor=$r,Ft.emphasize=x1;var D7=Ft.getContrastRatio=B7;Ft.getLuminance=dh,Ft.hexToRgb=E1,Ft.hslToRgb=T1;var U7=Ft.lighten=wE;Ft.private_safeAlpha=G7,Ft.private_safeColorChannel=void 0,Ft.private_safeDarken=H7,Ft.private_safeEmphasize=V7,Ft.private_safeLighten=q7,Ft.recomposeColor=kl,Ft.rgbToHex=z7;var b1=_1(N7),j7=_1(L7);function gE(e,t=0,n=1){return(0,j7.default)(e,t,n)}function E1(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&n[0].length===1&&(n=n.map(r=>r+r)),n?`rgb${n.length===4?"a":""}(${n.map((r,o)=>o<3?parseInt(r,16):Math.round(parseInt(r,16)/255*1e3)/1e3).join(", ")})`:""}function W7(e){const t=e.toString(16);return t.length===1?`0${t}`:t}function $r(e){if(e.type)return e;if(e.charAt(0)==="#")return $r(E1(e));const t=e.indexOf("("),n=e.substring(0,t);if(["rgb","rgba","hsl","hsla","color"].indexOf(n)===-1)throw new Error((0,b1.default)(9,e));let r=e.substring(t+1,e.length-1),o;if(n==="color"){if(r=r.split(" "),o=r.shift(),r.length===4&&r[3].charAt(0)==="/"&&(r[3]=r[3].slice(1)),["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o)===-1)throw new Error((0,b1.default)(10,o))}else r=r.split(",");return r=r.map(i=>parseFloat(i)),{type:n,values:r,colorSpace:o}}const S1=e=>{const t=$r(e);return t.values.slice(0,3).map((n,r)=>t.type.indexOf("hsl")!==-1&&r!==0?`${n}%`:n).join(" ")};Ft.colorChannel=S1;const F7=(e,t)=>{try{return S1(e)}catch{return e}};Ft.private_safeColorChannel=F7;function kl(e){const{type:t,colorSpace:n}=e;let{values:r}=e;return t.indexOf("rgb")!==-1?r=r.map((o,i)=>i<3?parseInt(o,10):o):t.indexOf("hsl")!==-1&&(r[1]=`${r[1]}%`,r[2]=`${r[2]}%`),t.indexOf("color")!==-1?r=`${n} ${r.join(" ")}`:r=`${r.join(", ")}`,`${t}(${r})`}function z7(e){if(e.indexOf("#")===0)return e;const{values:t}=$r(e);return`#${t.map((n,r)=>W7(r===3?Math.round(255*n):n)).join("")}`}function T1(e){e=$r(e);const{values:t}=e,n=t[0],r=t[1]/100,o=t[2]/100,i=r*Math.min(o,1-o),s=(c,u=(c+n/30)%12)=>o-i*Math.max(Math.min(u-3,9-u,1),-1);let a="rgb";const l=[Math.round(s(0)*255),Math.round(s(8)*255),Math.round(s(4)*255)];return e.type==="hsla"&&(a+="a",l.push(t[3])),kl({type:a,values:l})}function dh(e){e=$r(e);let t=e.type==="hsl"||e.type==="hsla"?$r(T1(e)).values:e.values;return t=t.map(n=>(e.type!=="color"&&(n/=255),n<=.03928?n/12.92:((n+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function B7(e,t){const n=dh(e),r=dh(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function k1(e,t){return e=$r(e),t=gE(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,kl(e)}function G7(e,t,n){try{return k1(e,t)}catch{return e}}function yE(e,t){if(e=$r(e),t=gE(t),e.type.indexOf("hsl")!==-1)e.values[2]*=1-t;else if(e.type.indexOf("rgb")!==-1||e.type.indexOf("color")!==-1)for(let n=0;n<3;n+=1)e.values[n]*=1-t;return kl(e)}function H7(e,t,n){try{return yE(e,t)}catch{return e}}function wE(e,t){if(e=$r(e),t=gE(t),e.type.indexOf("hsl")!==-1)e.values[2]+=(100-e.values[2])*t;else if(e.type.indexOf("rgb")!==-1)for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*t;else if(e.type.indexOf("color")!==-1)for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*t;return kl(e)}function q7(e,t,n){try{return wE(e,t)}catch{return e}}function x1(e,t=.15){return dh(e)>.5?yE(e,t):wE(e,t)}function V7(e,t,n){try{return x1(e,t)}catch{return e}}function K7(e,t,n,r=1){const o=(l,c)=>Math.round((l**(1/r)*(1-n)+c**(1/r)*n)**r),i=$r(e),s=$r(t),a=[o(i.values[0],s.values[0]),o(i.values[1],s.values[1]),o(i.values[2],s.values[2])];return kl({type:"rgb",values:a})}const id={black:"#000",white:"#fff"},Z7={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},xl={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},Cl={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},sd={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},Il={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},Pl={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},Rl={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},Y7=["mode","contrastThreshold","tonalOffset"],C1={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:id.white,default:id.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},vE={text:{primary:id.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:id.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function I1(e,t,n,r){const o=r.light||r,i=r.dark||r*1.5;e[t]||(e.hasOwnProperty(n)?e[t]=e[n]:t==="light"?e.light=U7(e.main,o):t==="dark"&&(e.dark=M7(e.main,i)))}function J7(e="light"){return e==="dark"?{main:Il[200],light:Il[50],dark:Il[400]}:{main:Il[700],light:Il[400],dark:Il[800]}}function X7(e="light"){return e==="dark"?{main:xl[200],light:xl[50],dark:xl[400]}:{main:xl[500],light:xl[300],dark:xl[700]}}function Q7(e="light"){return e==="dark"?{main:Cl[500],light:Cl[300],dark:Cl[700]}:{main:Cl[700],light:Cl[400],dark:Cl[800]}}function eK(e="light"){return e==="dark"?{main:Pl[400],light:Pl[300],dark:Pl[700]}:{main:Pl[700],light:Pl[500],dark:Pl[900]}}function tK(e="light"){return e==="dark"?{main:Rl[400],light:Rl[300],dark:Rl[700]}:{main:Rl[800],light:Rl[500],dark:Rl[900]}}function nK(e="light"){return e==="dark"?{main:sd[400],light:sd[300],dark:sd[700]}:{main:"#ed6c02",light:sd[500],dark:sd[900]}}function rK(e){const{mode:t="light",contrastThreshold:n=3,tonalOffset:r=.2}=e,o=xe(e,Y7),i=e.primary||J7(t),s=e.secondary||X7(t),a=e.error||Q7(t),l=e.info||eK(t),c=e.success||tK(t),u=e.warning||nK(t);function d(w){return D7(w,vE.text.primary)>=n?vE.text.primary:C1.text.primary}const p=({color:w,name:v,mainShade:f=500,lightShade:g=300,darkShade:y=700})=>{if(w=N({},w),!w.main&&w[f]&&(w.main=w[f]),!w.hasOwnProperty("main"))throw new Error(ch(11,v?` (${v})`:"",f));if(typeof w.main!="string")throw new Error(ch(12,v?` (${v})`:"",JSON.stringify(w.main)));return I1(w,"light",g,r),I1(w,"dark",y,r),w.contrastText||(w.contrastText=d(w.main)),w},m={dark:vE,light:C1};return Zi(N({common:N({},id),mode:t,primary:p({color:i,name:"primary"}),secondary:p({color:s,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:p({color:a,name:"error"}),warning:p({color:u,name:"warning"}),info:p({color:l,name:"info"}),success:p({color:c,name:"success"}),grey:Z7,contrastThreshold:n,getContrastText:d,augmentColor:p,tonalOffset:r},m[t]),o)}const oK=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];function iK(e){return Math.round(e*1e5)/1e5}const P1={textTransform:"uppercase"},R1='"Roboto", "Helvetica", "Arial", sans-serif';function sK(e,t){const n=typeof t=="function"?t(e):t,{fontFamily:r=R1,fontSize:o=14,fontWeightLight:i=300,fontWeightRegular:s=400,fontWeightMedium:a=500,fontWeightBold:l=700,htmlFontSize:c=16,allVariants:u,pxToRem:d}=n,p=xe(n,oK),m=o/14,h=d||(f=>`${f/c*m}rem`),w=(f,g,y,_,E)=>N({fontFamily:r,fontWeight:f,fontSize:h(g),lineHeight:y},r===R1?{letterSpacing:`${iK(_/g)}em`}:{},E,u),v={h1:w(i,96,1.167,-1.5),h2:w(i,60,1.2,-.5),h3:w(s,48,1.167,0),h4:w(s,34,1.235,.25),h5:w(s,24,1.334,0),h6:w(a,20,1.6,.15),subtitle1:w(s,16,1.75,.15),subtitle2:w(a,14,1.57,.1),body1:w(s,16,1.5,.15),body2:w(s,14,1.43,.15),button:w(a,14,1.75,.4,P1),caption:w(s,12,1.66,.4),overline:w(s,12,2.66,1,P1),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return Zi(N({htmlFontSize:c,pxToRem:h,fontFamily:r,fontSize:o,fontWeightLight:i,fontWeightRegular:s,fontWeightMedium:a,fontWeightBold:l},v),p,{clone:!1})}const aK=.2,lK=.14,cK=.12;function Et(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${aK})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${lK})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${cK})`].join(",")}const uK=["none",Et(0,2,1,-1,0,1,1,0,0,1,3,0),Et(0,3,1,-2,0,2,2,0,0,1,5,0),Et(0,3,3,-2,0,3,4,0,0,1,8,0),Et(0,2,4,-1,0,4,5,0,0,1,10,0),Et(0,3,5,-1,0,5,8,0,0,1,14,0),Et(0,3,5,-1,0,6,10,0,0,1,18,0),Et(0,4,5,-2,0,7,10,1,0,2,16,1),Et(0,5,5,-3,0,8,10,1,0,3,14,2),Et(0,5,6,-3,0,9,12,1,0,3,16,2),Et(0,6,6,-3,0,10,14,1,0,4,18,3),Et(0,6,7,-4,0,11,15,1,0,4,20,3),Et(0,7,8,-4,0,12,17,2,0,5,22,4),Et(0,7,8,-4,0,13,19,2,0,5,24,4),Et(0,7,9,-4,0,14,21,2,0,5,26,4),Et(0,8,9,-5,0,15,22,2,0,6,28,5),Et(0,8,10,-5,0,16,24,2,0,6,30,5),Et(0,8,11,-5,0,17,26,2,0,6,32,5),Et(0,9,11,-5,0,18,28,2,0,7,34,6),Et(0,9,12,-6,0,19,29,2,0,7,36,6),Et(0,10,13,-6,0,20,31,3,0,8,38,7),Et(0,10,13,-6,0,21,33,3,0,8,40,7),Et(0,10,14,-6,0,22,35,3,0,8,42,7),Et(0,11,14,-7,0,23,36,3,0,9,44,8),Et(0,11,15,-7,0,24,38,3,0,9,46,8)],dK=["duration","easing","delay"],pK={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},fK={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function A1(e){return`${Math.round(e)}ms`}function mK(e){if(!e)return 0;const t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function hK(e){const t=N({},pK,e.easing),n=N({},fK,e.duration);return N({getAutoHeightDuration:mK,create:(o=["all"],i={})=>{const{duration:s=n.standard,easing:a=t.easeInOut,delay:l=0}=i;return xe(i,dK),(Array.isArray(o)?o:[o]).map(c=>`${c} ${typeof s=="string"?s:A1(s)} ${a} ${typeof l=="string"?l:A1(l)}`).join(",")}},e,{easing:t,duration:n})}const gK={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},yK=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];function _E(e={},...t){const{mixins:n={},palette:r={},transitions:o={},typography:i={}}=e,s=xe(e,yK);if(e.vars)throw new Error(ch(18));const a=rK(r),l=Xu(e);let c=Zi(l,{mixins:O7(l.breakpoints,n),palette:a,shadows:uK.slice(),typography:sK(a,i),transitions:hK(o),zIndex:N({},gK)});return c=Zi(c,s),c=t.reduce((u,d)=>Zi(u,d),c),c.unstable_sxConfig=N({},Ju,s==null?void 0:s.unstable_sxConfig),c.unstable_sx=function(d){return wl({sx:d,theme:this})},c}const bE=_E(),zs="$$material";function St({props:e,name:t}){return p1({props:e,name:t,defaultTheme:bE,themeId:zs})}var ad={},EE={exports:{}},$1;function wK(){return $1||($1=1,function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(n){for(var r=1;r96}function Eh(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const UK=ad.systemDefaultTheme=(0,RK.default)(),jK=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function Sh({defaultTheme:e,theme:t,themeId:n}){return MK(t)?e:t[n]||t}function WK(e){return e?(t,n)=>n[e]:null}function Th(e,t){let{ownerState:n}=t,r=(0,xE.default)(t,$K);const o=typeof e=="function"?e((0,Nr.default)({ownerState:n},r)):e;if(Array.isArray(o))return o.flatMap(i=>Th(i,(0,Nr.default)({ownerState:n},r)));if(o&&typeof o=="object"&&Array.isArray(o.variants)){const{variants:i=[]}=o;let a=(0,xE.default)(o,OK);return i.forEach(l=>{let c=!0;typeof l.props=="function"?c=l.props((0,Nr.default)({ownerState:n},r,n)):Object.keys(l.props).forEach(u=>{(n==null?void 0:n[u])!==l.props[u]&&r[u]!==l.props[u]&&(c=!1)}),c&&(Array.isArray(a)||(a=[a]),a.push(typeof l.style=="function"?l.style((0,Nr.default)({ownerState:n},r,n)):l.style))}),a}return o}function FK(e={}){const{themeId:t,defaultTheme:n=UK,rootShouldForwardProp:r=Eh,slotShouldForwardProp:o=Eh}=e,i=s=>(0,AK.default)((0,Nr.default)({},s,{theme:Sh((0,Nr.default)({},s,{defaultTheme:n,themeId:t}))}));return i.__mui_systemSx=!0,(s,a={})=>{(0,F1.internal_processStyles)(s,E=>E.filter(S=>!(S!=null&&S.__mui_systemSx)));const{name:l,slot:c,skipVariantsResolver:u,skipSx:d,overridesResolver:p=WK(jK(c))}=a,m=(0,xE.default)(a,NK),h=u!==void 0?u:c&&c!=="Root"&&c!=="root"||!1,w=d||!1;let v,f=Eh;c==="Root"||c==="root"?f=r:c?f=o:DK(s)&&(f=void 0);const g=(0,F1.default)(s,(0,Nr.default)({shouldForwardProp:f,label:v},m)),y=E=>typeof E=="function"&&E.__emotion_real!==E||(0,PK.isPlainObject)(E)?S=>Th(E,(0,Nr.default)({},S,{theme:Sh({theme:S.theme,defaultTheme:n,themeId:t})})):E,_=(E,...S)=>{let k=y(E);const C=S?S.map(y):[];l&&p&&C.push(T=>{const A=Sh((0,Nr.default)({},T,{defaultTheme:n,themeId:t}));if(!A.components||!A.components[l]||!A.components[l].styleOverrides)return null;const L=A.components[l].styleOverrides,j={};return Object.entries(L).forEach(([q,K])=>{j[q]=Th(K,(0,Nr.default)({},T,{theme:A}))}),p(T,j)}),l&&!h&&C.push(T=>{var A;const L=Sh((0,Nr.default)({},T,{defaultTheme:n,themeId:t})),j=L==null||(A=L.components)==null||(A=A[l])==null?void 0:A.variants;return Th({variants:j},(0,Nr.default)({},T,{theme:L}))}),w||C.push(i);const O=C.length-S.length;if(Array.isArray(E)&&O>0){const T=new Array(O).fill("");k=[...E,...T],k.raw=[...E.raw,...T]}const U=g(k,...C);return s.muiName&&(U.muiName=s.muiName),U};return g.withConfig&&(_.withConfig=g.withConfig),_}}function zK(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const kh=e=>zK(e)&&e!=="classes",Me=W1({themeId:zs,defaultTheme:bE,rootShouldForwardProp:kh});function CE(e,t){return CE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},CE(e,t)}function B1(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,CE(e,t)}const G1={disabled:!1},xh=we.createContext(null);var BK=function(t){return t.scrollTop},ld="unmounted",Bs="exited",Gs="entering",$l="entered",IE="exiting",ii=function(e){B1(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var s=o,a=s&&!s.isMounting?r.enter:r.appear,l;return i.appearStatus=null,r.in?a?(l=Bs,i.appearStatus=Gs):l=$l:r.unmountOnExit||r.mountOnEnter?l=ld:l=Bs,i.state={status:l},i.nextCallback=null,i}t.getDerivedStateFromProps=function(o,i){var s=o.in;return s&&i.status===ld?{status:Bs}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var i=null;if(o!==this.props){var s=this.state.status;this.props.in?s!==Gs&&s!==$l&&(i=Gs):(s===Gs||s===$l)&&(i=IE)}this.updateStatus(!1,i)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,i,s,a;return i=s=a=o,o!=null&&typeof o!="number"&&(i=o.exit,s=o.enter,a=o.appear!==void 0?o.appear:s),{exit:i,enter:s,appear:a}},n.updateStatus=function(o,i){if(o===void 0&&(o=!1),i!==null)if(this.cancelNextCallback(),i===Gs){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:Lm.findDOMNode(this);s&&BK(s)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Bs&&this.setState({status:ld})},n.performEnter=function(o){var i=this,s=this.props.enter,a=this.context?this.context.isMounting:o,l=this.props.nodeRef?[a]:[Lm.findDOMNode(this),a],c=l[0],u=l[1],d=this.getTimeouts(),p=a?d.appear:d.enter;if(!o&&!s||G1.disabled){this.safeSetState({status:$l},function(){i.props.onEntered(c)});return}this.props.onEnter(c,u),this.safeSetState({status:Gs},function(){i.props.onEntering(c,u),i.onTransitionEnd(p,function(){i.safeSetState({status:$l},function(){i.props.onEntered(c,u)})})})},n.performExit=function(){var o=this,i=this.props.exit,s=this.getTimeouts(),a=this.props.nodeRef?void 0:Lm.findDOMNode(this);if(!i||G1.disabled){this.safeSetState({status:Bs},function(){o.props.onExited(a)});return}this.props.onExit(a),this.safeSetState({status:IE},function(){o.props.onExiting(a),o.onTransitionEnd(s.exit,function(){o.safeSetState({status:Bs},function(){o.props.onExited(a)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(o,i){i=this.setNextCallback(i),this.setState(o,i)},n.setNextCallback=function(o){var i=this,s=!0;return this.nextCallback=function(a){s&&(s=!1,i.nextCallback=null,o(a))},this.nextCallback.cancel=function(){s=!1},this.nextCallback},n.onTransitionEnd=function(o,i){this.setNextCallback(i);var s=this.props.nodeRef?this.props.nodeRef.current:Lm.findDOMNode(this),a=o==null&&!this.props.addEndListener;if(!s||a){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],c=l[0],u=l[1];this.props.addEndListener(c,u)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===ld)return null;var i=this.props,s=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var a=xe(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return we.createElement(xh.Provider,{value:null},typeof s=="function"?s(o,a):we.cloneElement(we.Children.only(s),a))},t}(we.Component);ii.contextType=xh,ii.propTypes={};function Ol(){}ii.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Ol,onEntering:Ol,onEntered:Ol,onExit:Ol,onExiting:Ol,onExited:Ol},ii.UNMOUNTED=ld,ii.EXITED=Bs,ii.ENTERING=Gs,ii.ENTERED=$l,ii.EXITING=IE;function GK(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function PE(e,t){var n=function(i){return t&&P.isValidElement(i)?t(i):i},r=Object.create(null);return e&&P.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function HK(e,t){e=e||{},t=t||{};function n(u){return u in t?t[u]:e[u]}var r=Object.create(null),o=[];for(var i in e)i in t?o.length&&(r[i]=o,o=[]):o.push(i);var s,a={};for(var l in t){if(r[l])for(s=0;s{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)},this.disposeEffect=()=>this.clear}static create(){return new Ch}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,n()},t)}}function QK(){const e=YK(Ch.create).current;return XK(e.disposeEffect),e}const eZ=e=>e.scrollTop;function q1(e,t){var n,r;const{timeout:o,easing:i,style:s={}}=e;return{duration:(n=s.transitionDuration)!=null?n:typeof o=="number"?o:o[t.mode]||0,easing:(r=s.transitionTimingFunction)!=null?r:typeof i=="object"?i[t.mode]:i,delay:s.transitionDelay}}const V1=e=>e,tZ=(()=>{let e=V1;return{configure(t){e=t},generate(t){return e(t)},reset(){e=V1}}})(),nZ=["className","component"];function rZ(e={}){const{themeId:t,defaultTheme:n,defaultClassName:r="MuiBox-root",generateClassName:o}=e,i=fE("div",{shouldForwardProp:a=>a!=="theme"&&a!=="sx"&&a!=="as"})(wl);return P.forwardRef(function(l,c){const u=hE(n),d=uh(l),{className:p,component:m="div"}=d,h=xe(d,nZ);return R.jsx(i,N({as:m,ref:c,className:Se(p,o?o(r):r),theme:t&&u[t]||u},h))})}const oZ={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function iZ(e,t,n="Mui"){const r=oZ[t];return r?`${n}-${r}`:`${tZ.generate(e)}-${t}`}const sZ=["ownerState"],aZ=["variants"],lZ=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function cZ(e){return Object.keys(e).length===0}function uZ(e){return typeof e=="string"&&e.charCodeAt(0)>96}function AE(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const dZ=Xu(),pZ=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function Ih({defaultTheme:e,theme:t,themeId:n}){return cZ(t)?e:t[n]||t}function fZ(e){return e?(t,n)=>n[e]:null}function Ph(e,t){let{ownerState:n}=t,r=xe(t,sZ);const o=typeof e=="function"?e(N({ownerState:n},r)):e;if(Array.isArray(o))return o.flatMap(i=>Ph(i,N({ownerState:n},r)));if(o&&typeof o=="object"&&Array.isArray(o.variants)){const{variants:i=[]}=o;let a=xe(o,aZ);return i.forEach(l=>{let c=!0;typeof l.props=="function"?c=l.props(N({ownerState:n},r,n)):Object.keys(l.props).forEach(u=>{(n==null?void 0:n[u])!==l.props[u]&&r[u]!==l.props[u]&&(c=!1)}),c&&(Array.isArray(a)||(a=[a]),a.push(typeof l.style=="function"?l.style(N({ownerState:n},r,n)):l.style))}),a}return o}function mZ(e={}){const{themeId:t,defaultTheme:n=dZ,rootShouldForwardProp:r=AE,slotShouldForwardProp:o=AE}=e,i=s=>wl(N({},s,{theme:Ih(N({},s,{defaultTheme:n,themeId:t}))}));return i.__mui_systemSx=!0,(s,a={})=>{u1(s,E=>E.filter(S=>!(S!=null&&S.__mui_systemSx)));const{name:l,slot:c,skipVariantsResolver:u,skipSx:d,overridesResolver:p=fZ(pZ(c))}=a,m=xe(a,lZ),h=u!==void 0?u:c&&c!=="Root"&&c!=="root"||!1,w=d||!1;let v,f=AE;c==="Root"||c==="root"?f=r:c?f=o:uZ(s)&&(f=void 0);const g=fE(s,N({shouldForwardProp:f,label:v},m)),y=E=>typeof E=="function"&&E.__emotion_real!==E||oi(E)?S=>Ph(E,N({},S,{theme:Ih({theme:S.theme,defaultTheme:n,themeId:t})})):E,_=(E,...S)=>{let k=y(E);const C=S?S.map(y):[];l&&p&&C.push(T=>{const A=Ih(N({},T,{defaultTheme:n,themeId:t}));if(!A.components||!A.components[l]||!A.components[l].styleOverrides)return null;const L=A.components[l].styleOverrides,j={};return Object.entries(L).forEach(([q,K])=>{j[q]=Ph(K,N({},T,{theme:A}))}),p(T,j)}),l&&!h&&C.push(T=>{var A;const L=Ih(N({},T,{defaultTheme:n,themeId:t})),j=L==null||(A=L.components)==null||(A=A[l])==null?void 0:A.variants;return Ph({variants:j},N({},T,{theme:L}))}),w||C.push(i);const O=C.length-S.length;if(Array.isArray(E)&&O>0){const T=new Array(O).fill("");k=[...E,...T],k.raw=[...E.raw,...T]}const U=g(k,...C);return s.muiName&&(U.muiName=s.muiName),U};return g.withConfig&&(_.withConfig=g.withConfig),_}}const hZ=mZ(),gZ=typeof window<"u"?P.useLayoutEffect:P.useEffect;function yZ(e,t,n,r,o){const[i,s]=P.useState(()=>o&&n?n(e).matches:r?r(e).matches:t);return gZ(()=>{let a=!0;if(!n)return;const l=n(e),c=()=>{a&&s(l.matches)};return c(),l.addListener(c),()=>{a=!1,l.removeListener(c)}},[e,n]),i}const K1=P.useSyncExternalStore;function wZ(e,t,n,r,o){const i=P.useCallback(()=>t,[t]),s=P.useMemo(()=>{if(o&&n)return()=>n(e).matches;if(r!==null){const{matches:u}=r(e);return()=>u}return i},[i,e,r,o,n]),[a,l]=P.useMemo(()=>{if(n===null)return[i,()=>()=>{}];const u=n(e);return[()=>u.matches,d=>(u.addListener(d),()=>{u.removeListener(d)})]},[i,n,e]);return K1(l,a,s)}function vZ(e,t={}){const n=mE(),r=typeof window<"u"&&typeof window.matchMedia<"u",{defaultMatches:o=!1,matchMedia:i=r?window.matchMedia:null,ssrMatchMedia:s=null,noSsr:a=!1}=x$({name:"MuiUseMediaQuery",props:t,theme:n});let l=e;return l=l.replace(/^@media( ?)/m,""),(K1!==void 0?wZ:yZ)(l,o,i,s,a)}function $E(e,t=0,n=1){return v1(e,t,n)}function _Z(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&n[0].length===1&&(n=n.map(r=>r+r)),n?`rgb${n.length===4?"a":""}(${n.map((r,o)=>o<3?parseInt(r,16):Math.round(parseInt(r,16)/255*1e3)/1e3).join(", ")})`:""}function Rh(e){if(e.type)return e;if(e.charAt(0)==="#")return Rh(_Z(e));const t=e.indexOf("("),n=e.substring(0,t);if(["rgb","rgba","hsl","hsla","color"].indexOf(n)===-1)throw new Error(Mm(9,e));let r=e.substring(t+1,e.length-1),o;if(n==="color"){if(r=r.split(" "),o=r.shift(),r.length===4&&r[3].charAt(0)==="/"&&(r[3]=r[3].slice(1)),["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o)===-1)throw new Error(Mm(10,o))}else r=r.split(",");return r=r.map(i=>parseFloat(i)),{type:n,values:r,colorSpace:o}}function OE(e){const{type:t,colorSpace:n}=e;let{values:r}=e;return t.indexOf("rgb")!==-1?r=r.map((o,i)=>i<3?parseInt(o,10):o):t.indexOf("hsl")!==-1&&(r[1]=`${r[1]}%`,r[2]=`${r[2]}%`),t.indexOf("color")!==-1?r=`${n} ${r.join(" ")}`:r=`${r.join(", ")}`,`${t}(${r})`}function NE(e,t){return e=Rh(e),t=$E(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,OE(e)}function Nl(e,t){if(e=Rh(e),t=$E(t),e.type.indexOf("hsl")!==-1)e.values[2]*=1-t;else if(e.type.indexOf("rgb")!==-1||e.type.indexOf("color")!==-1)for(let n=0;n<3;n+=1)e.values[n]*=1-t;return OE(e)}function Ll(e,t){if(e=Rh(e),t=$E(t),e.type.indexOf("hsl")!==-1)e.values[2]+=(100-e.values[2])*t;else if(e.type.indexOf("rgb")!==-1)for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*t;else if(e.type.indexOf("color")!==-1)for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*t;return OE(e)}function bZ(e,t,n=void 0){const r={};return Object.keys(e).forEach(o=>{r[o]=e[o].reduce((i,s)=>{if(s){const a=t(s);a!==""&&i.push(a),n&&n[s]&&i.push(n[s])}return i},[]).join(" ")}),r}const Z1=P.createContext(null);function Y1(){return P.useContext(Z1)}const EZ=typeof Symbol=="function"&&Symbol.for?Symbol.for("mui.nested"):"__THEME_NESTED__";function SZ(e,t){return typeof t=="function"?t(e):N({},e,t)}function TZ(e){const{children:t,theme:n}=e,r=Y1(),o=P.useMemo(()=>{const i=r===null?n:SZ(r,n);return i!=null&&(i[EZ]=r!==null),i},[n,r]);return R.jsx(Z1.Provider,{value:o,children:t})}const kZ=["value"],xZ=P.createContext();function CZ(e){let{value:t}=e,n=xe(e,kZ);return R.jsx(xZ.Provider,N({value:t??!0},n))}const IZ=P.createContext(void 0);function PZ({value:e,children:t}){return R.jsx(IZ.Provider,{value:e,children:t})}const J1={};function X1(e,t,n,r=!1){return P.useMemo(()=>{const o=e&&t[e]||t;if(typeof n=="function"){const i=n(o),s=e?N({},t,{[e]:i}):i;return r?()=>s:s}return e?N({},t,{[e]:n}):N({},t,n)},[e,t,n,r])}function RZ(e){const{children:t,theme:n,themeId:r}=e,o=mE(J1),i=Y1()||J1,s=X1(r,o,n),a=X1(r,i,n,!0),l=s.direction==="rtl";return R.jsx(TZ,{theme:a,children:R.jsx(El.Provider,{value:s,children:R.jsx(CZ,{value:l,children:R.jsx(PZ,{value:s==null?void 0:s.components,children:t})})})})}const AZ=["component","direction","spacing","divider","children","className","useFlexGap"],$Z=Xu(),OZ=hZ("div",{name:"MuiStack",slot:"Root",overridesResolver:(e,t)=>t.root});function NZ(e){return p1({props:e,name:"MuiStack",defaultTheme:$Z})}function LZ(e,t){const n=P.Children.toArray(e).filter(Boolean);return n.reduce((r,o,i)=>(r.push(o),i({row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"})[e],DZ=({ownerState:e,theme:t})=>{let n=N({display:"flex",flexDirection:"column"},so({theme:t},qb({values:e.direction,breakpoints:t.breakpoints.values}),r=>({flexDirection:r})));if(e.spacing){const r=Yb(t),o=Object.keys(t.breakpoints.values).reduce((l,c)=>((typeof e.spacing=="object"&&e.spacing[c]!=null||typeof e.direction=="object"&&e.direction[c]!=null)&&(l[c]=!0),l),{}),i=qb({values:e.direction,base:o}),s=qb({values:e.spacing,base:o});typeof i=="object"&&Object.keys(i).forEach((l,c,u)=>{if(!i[l]){const p=c>0?i[u[c-1]]:"column";i[l]=p}}),n=Ws(n,so({theme:t},s,(l,c)=>e.useFlexGap?{gap:Fs(r,l)}:{"& > :not(style):not(style)":{margin:0},"& > :not(style) ~ :not(style)":{[`margin${MZ(c?i[c]:e.direction)}`]:Fs(r,l)}}))}return n=PV(t.breakpoints,n),n};function UZ(e={}){const{createStyledComponent:t=OZ,useThemeProps:n=NZ,componentName:r="MuiStack"}=e,o=()=>bZ({root:["root"]},l=>iZ(r,l),{}),i=t(DZ);return P.forwardRef(function(l,c){const u=n(l),d=uh(u),{component:p="div",direction:m="column",spacing:h=0,divider:w,children:v,className:f,useFlexGap:g=!1}=d,y=xe(d,AZ),_={direction:m,spacing:h,useFlexGap:g},E=o();return R.jsx(i,N({as:p,ownerState:_,ref:c,className:Se(E.root,f)},y,{children:w?LZ(v,w):v}))})}function cd(){const e=hE(bE);return e[zs]||e}function ae(e){if(typeof e!="string")throw new Error(ch(7));return e.charAt(0).toUpperCase()+e.slice(1)}function Q1(...e){return e.reduce((t,n)=>n==null?t:function(...o){t.apply(this,o),n.apply(this,o)},()=>{})}function jZ(e,t){var n,r;return P.isValidElement(e)&&t.indexOf((n=e.type.muiName)!=null?n:(r=e.type)==null||(r=r._payload)==null||(r=r.value)==null?void 0:r.muiName)!==-1}function Io(e){return e&&e.ownerDocument||document}function LE(e){return Io(e).defaultView||window}function ME(e,t){typeof e=="function"?e(t):e&&(e.current=t)}const Ml=typeof window<"u"?P.useLayoutEffect:P.useEffect;let eO=0;function WZ(e){const[t,n]=P.useState(e),r=e||t;return P.useEffect(()=>{t==null&&(eO+=1,n(`mui-${eO}`))},[t]),r}const tO=Mv.useId;function FZ(e){if(tO!==void 0){const t=tO();return e??t}return WZ(e)}function zZ({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=P.useRef(e!==void 0),[i,s]=P.useState(t),a=o?e:i,l=P.useCallback(c=>{o||s(c)},[]);return[a,l]}function Dl(e){const t=P.useRef(e);return Ml(()=>{t.current=e}),P.useRef((...n)=>(0,t.current)(...n)).current}function Lr(...e){return P.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{ME(n,t)})},e)}let Ah=!0,DE=!1;const BZ=new Ch,GZ={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function HZ(e){const{type:t,tagName:n}=e;return!!(n==="INPUT"&&GZ[t]&&!e.readOnly||n==="TEXTAREA"&&!e.readOnly||e.isContentEditable)}function qZ(e){e.metaKey||e.altKey||e.ctrlKey||(Ah=!0)}function UE(){Ah=!1}function VZ(){this.visibilityState==="hidden"&&DE&&(Ah=!0)}function KZ(e){e.addEventListener("keydown",qZ,!0),e.addEventListener("mousedown",UE,!0),e.addEventListener("pointerdown",UE,!0),e.addEventListener("touchstart",UE,!0),e.addEventListener("visibilitychange",VZ,!0)}function ZZ(e){const{target:t}=e;try{return t.matches(":focus-visible")}catch{}return Ah||HZ(t)}function nO(){const e=P.useCallback(o=>{o!=null&&KZ(o.ownerDocument)},[]),t=P.useRef(!1);function n(){return t.current?(DE=!0,BZ.start(100,()=>{DE=!1}),t.current=!1,!0):!1}function r(o){return ZZ(o)?(t.current=!0,!0):!1}return{isFocusVisibleRef:t,onFocus:r,onBlur:n,ref:e}}function YZ(e){const t=e.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}function rO(e,t){const n=N({},t);return Object.keys(e).forEach(r=>{if(r.toString().match(/^(components|slots)$/))n[r]=N({},e[r],n[r]);else if(r.toString().match(/^(componentsProps|slotProps)$/)){const o=e[r]||{},i=t[r];n[r]={},!i||!Object.keys(i)?n[r]=o:!o||!Object.keys(o)?n[r]=i:(n[r]=N({},i),Object.keys(o).forEach(s=>{n[r][s]=rO(o[s],i[s])}))}else n[r]===void 0&&(n[r]=e[r])}),n}function vt(e,t,n="Mui"){const r={};return t.forEach(o=>{r[o]=Ot(e,o,n)}),r}function JZ(e){return Ot("MuiSvgIcon",e)}vt("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const XZ=["children","className","color","component","fontSize","htmlColor","inheritViewBox","titleAccess","viewBox"],QZ=e=>{const{color:t,fontSize:n,classes:r}=e,o={root:["root",t!=="inherit"&&`color${ae(t)}`,`fontSize${ae(n)}`]};return $t(o,JZ,r)},eY=Me("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${ae(n.color)}`],t[`fontSize${ae(n.fontSize)}`]]}})(({theme:e,ownerState:t})=>{var n,r,o,i,s,a,l,c,u,d,p,m,h;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:t.hasSvgAsChild?void 0:"currentColor",flexShrink:0,transition:(n=e.transitions)==null||(r=n.create)==null?void 0:r.call(n,"fill",{duration:(o=e.transitions)==null||(o=o.duration)==null?void 0:o.shorter}),fontSize:{inherit:"inherit",small:((i=e.typography)==null||(s=i.pxToRem)==null?void 0:s.call(i,20))||"1.25rem",medium:((a=e.typography)==null||(l=a.pxToRem)==null?void 0:l.call(a,24))||"1.5rem",large:((c=e.typography)==null||(u=c.pxToRem)==null?void 0:u.call(c,35))||"2.1875rem"}[t.fontSize],color:(d=(p=(e.vars||e).palette)==null||(p=p[t.color])==null?void 0:p.main)!=null?d:{action:(m=(e.vars||e).palette)==null||(m=m.action)==null?void 0:m.active,disabled:(h=(e.vars||e).palette)==null||(h=h.action)==null?void 0:h.disabled,inherit:void 0}[t.color]}}),$h=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiSvgIcon"}),{children:o,className:i,color:s="inherit",component:a="svg",fontSize:l="medium",htmlColor:c,inheritViewBox:u=!1,titleAccess:d,viewBox:p="0 0 24 24"}=r,m=xe(r,XZ),h=P.isValidElement(o)&&o.type==="svg",w=N({},r,{color:s,component:a,fontSize:l,instanceFontSize:t.fontSize,inheritViewBox:u,viewBox:p,hasSvgAsChild:h}),v={};u||(v.viewBox=p);const f=QZ(w);return R.jsxs(eY,N({as:a,className:Se(f.root,i),focusable:"false",color:c,"aria-hidden":d?void 0:!0,role:d?"img":void 0,ref:n},v,m,h&&o.props,{ownerState:w,children:[h?o.props.children:o,d?R.jsx("title",{children:d}):null]}))});$h.muiName="SvgIcon";function Oh(e,t){function n(r,o){return R.jsx($h,N({"data-testid":`${t}Icon`,ref:o},r,{children:e}))}return n.muiName=$h.muiName,P.memo(P.forwardRef(n))}const oO=e=>{let t;return e<1?t=5.11916*e**2:t=4.5*Math.log(e+1)+2,(t/100).toFixed(2)};function tY(e){return Ot("MuiPaper",e)}vt("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);const nY=["className","component","elevation","square","variant"],rY=e=>{const{square:t,elevation:n,variant:r,classes:o}=e,i={root:["root",r,!t&&"rounded",r==="elevation"&&`elevation${n}`]};return $t(i,tY,o)},oY=Me("div",{name:"MuiPaper",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],!n.square&&t.rounded,n.variant==="elevation"&&t[`elevation${n.elevation}`]]}})(({theme:e,ownerState:t})=>{var n;return N({backgroundColor:(e.vars||e).palette.background.paper,color:(e.vars||e).palette.text.primary,transition:e.transitions.create("box-shadow")},!t.square&&{borderRadius:e.shape.borderRadius},t.variant==="outlined"&&{border:`1px solid ${(e.vars||e).palette.divider}`},t.variant==="elevation"&&N({boxShadow:(e.vars||e).shadows[t.elevation]},!e.vars&&e.palette.mode==="dark"&&{backgroundImage:`linear-gradient(${wt("#fff",oO(t.elevation))}, ${wt("#fff",oO(t.elevation))})`},e.vars&&{backgroundImage:(n=e.vars.overlays)==null?void 0:n[t.elevation]}))}),iO=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiPaper"}),{className:o,component:i="div",elevation:s=1,square:a=!1,variant:l="elevation"}=r,c=xe(r,nY),u=N({},r,{component:i,elevation:s,square:a,variant:l}),d=rY(u);return R.jsx(oY,N({as:i,ownerState:u,className:Se(d.root,o),ref:n},c))});function jE(e){return typeof e=="string"}function iY(e,t,n){return e===void 0||jE(e)?t:N({},t,{ownerState:N({},t.ownerState,n)})}const sY={disableDefaultClasses:!1},aY=P.createContext(sY);function lY(e){const{disableDefaultClasses:t}=P.useContext(aY);return n=>t?"":e(n)}function sO(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function cY(e,t,n){return typeof e=="function"?e(t,n):e}function aO(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function uY(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:o,className:i}=e;if(!t){const m=Se(n==null?void 0:n.className,i,o==null?void 0:o.className,r==null?void 0:r.className),h=N({},n==null?void 0:n.style,o==null?void 0:o.style,r==null?void 0:r.style),w=N({},n,o,r);return m.length>0&&(w.className=m),Object.keys(h).length>0&&(w.style=h),{props:w,internalRef:void 0}}const s=sO(N({},o,r)),a=aO(r),l=aO(o),c=t(s),u=Se(c==null?void 0:c.className,n==null?void 0:n.className,i,o==null?void 0:o.className,r==null?void 0:r.className),d=N({},c==null?void 0:c.style,n==null?void 0:n.style,o==null?void 0:o.style,r==null?void 0:r.style),p=N({},c,n,l,a);return u.length>0&&(p.className=u),Object.keys(d).length>0&&(p.style=d),{props:p,internalRef:c.ref}}const dY=["elementType","externalSlotProps","ownerState","skipResolvingSlotProps"];function WE(e){var t;const{elementType:n,externalSlotProps:r,ownerState:o,skipResolvingSlotProps:i=!1}=e,s=xe(e,dY),a=i?{}:cY(r,o),{props:l,internalRef:c}=uY(N({},s,{externalSlotProps:a})),u=Lr(c,a==null?void 0:a.ref,(t=e.additionalProps)==null?void 0:t.ref);return iY(n,N({},l,{ref:u}),o)}function pY(e){const{className:t,classes:n,pulsate:r=!1,rippleX:o,rippleY:i,rippleSize:s,in:a,onExited:l,timeout:c}=e,[u,d]=P.useState(!1),p=Se(t,n.ripple,n.rippleVisible,r&&n.ripplePulsate),m={width:s,height:s,top:-(s/2)+i,left:-(s/2)+o},h=Se(n.child,u&&n.childLeaving,r&&n.childPulsate);return!a&&!u&&d(!0),P.useEffect(()=>{if(!a&&l!=null){const w=setTimeout(l,c);return()=>{clearTimeout(w)}}},[l,a,c]),R.jsx("span",{className:p,style:m,children:R.jsx("span",{className:h})})}const Mr=vt("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),fY=["center","classes","className"];let Nh=e=>e,lO,cO,uO,dO;const FE=550,mY=80,hY=Sl(lO||(lO=Nh` 0% { transform: scale(0); opacity: 0.1; } 100% { transform: scale(1); opacity: 0.3; } `)),gY=Sl(cO||(cO=Nh` 0% { opacity: 1; } 100% { opacity: 0; } `)),yY=Sl(uO||(uO=Nh` 0% { transform: scale(1); } 50% { transform: scale(0.92); } 100% { transform: scale(1); } `)),wY=Me("span",{name:"MuiTouchRipple",slot:"Root"})({overflow:"hidden",pointerEvents:"none",position:"absolute",zIndex:0,top:0,right:0,bottom:0,left:0,borderRadius:"inherit"}),vY=Me(pY,{name:"MuiTouchRipple",slot:"Ripple"})(dO||(dO=Nh` opacity: 0; position: absolute; &.${0} { opacity: 0.3; transform: scale(1); animation-name: ${0}; animation-duration: ${0}ms; animation-timing-function: ${0}; } &.${0} { animation-duration: ${0}ms; } & .${0} { opacity: 1; display: block; width: 100%; height: 100%; border-radius: 50%; background-color: currentColor; } & .${0} { opacity: 0; animation-name: ${0}; animation-duration: ${0}ms; animation-timing-function: ${0}; } & .${0} { position: absolute; /* @noflip */ left: 0px; top: 0; animation-name: ${0}; animation-duration: 2500ms; animation-timing-function: ${0}; animation-iteration-count: infinite; animation-delay: 200ms; } `),Mr.rippleVisible,hY,FE,({theme:e})=>e.transitions.easing.easeInOut,Mr.ripplePulsate,({theme:e})=>e.transitions.duration.shorter,Mr.child,Mr.childLeaving,gY,FE,({theme:e})=>e.transitions.easing.easeInOut,Mr.childPulsate,yY,({theme:e})=>e.transitions.easing.easeInOut),_Y=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiTouchRipple"}),{center:o=!1,classes:i={},className:s}=r,a=xe(r,fY),[l,c]=P.useState([]),u=P.useRef(0),d=P.useRef(null);P.useEffect(()=>{d.current&&(d.current(),d.current=null)},[l]);const p=P.useRef(!1),m=QK(),h=P.useRef(null),w=P.useRef(null),v=P.useCallback(_=>{const{pulsate:E,rippleX:S,rippleY:k,rippleSize:C,cb:O}=_;c(U=>[...U,R.jsx(vY,{classes:{ripple:Se(i.ripple,Mr.ripple),rippleVisible:Se(i.rippleVisible,Mr.rippleVisible),ripplePulsate:Se(i.ripplePulsate,Mr.ripplePulsate),child:Se(i.child,Mr.child),childLeaving:Se(i.childLeaving,Mr.childLeaving),childPulsate:Se(i.childPulsate,Mr.childPulsate)},timeout:FE,pulsate:E,rippleX:S,rippleY:k,rippleSize:C},u.current)]),u.current+=1,d.current=O},[i]),f=P.useCallback((_={},E={},S=()=>{})=>{const{pulsate:k=!1,center:C=o||E.pulsate,fakeElement:O=!1}=E;if((_==null?void 0:_.type)==="mousedown"&&p.current){p.current=!1;return}(_==null?void 0:_.type)==="touchstart"&&(p.current=!0);const U=O?null:w.current,T=U?U.getBoundingClientRect():{width:0,height:0,left:0,top:0};let A,L,j;if(C||_===void 0||_.clientX===0&&_.clientY===0||!_.clientX&&!_.touches)A=Math.round(T.width/2),L=Math.round(T.height/2);else{const{clientX:q,clientY:K}=_.touches&&_.touches.length>0?_.touches[0]:_;A=Math.round(q-T.left),L=Math.round(K-T.top)}if(C)j=Math.sqrt((2*T.width**2+T.height**2)/3),j%2===0&&(j+=1);else{const q=Math.max(Math.abs((U?U.clientWidth:0)-A),A)*2+2,K=Math.max(Math.abs((U?U.clientHeight:0)-L),L)*2+2;j=Math.sqrt(q**2+K**2)}_!=null&&_.touches?h.current===null&&(h.current=()=>{v({pulsate:k,rippleX:A,rippleY:L,rippleSize:j,cb:S})},m.start(mY,()=>{h.current&&(h.current(),h.current=null)})):v({pulsate:k,rippleX:A,rippleY:L,rippleSize:j,cb:S})},[o,v,m]),g=P.useCallback(()=>{f({},{pulsate:!0})},[f]),y=P.useCallback((_,E)=>{if(m.clear(),(_==null?void 0:_.type)==="touchend"&&h.current){h.current(),h.current=null,m.start(0,()=>{y(_,E)});return}h.current=null,c(S=>S.length>0?S.slice(1):S),d.current=E},[m]);return P.useImperativeHandle(n,()=>({pulsate:g,start:f,stop:y}),[g,f,y]),R.jsx(wY,N({className:Se(Mr.root,i.root,s),ref:w},a,{children:R.jsx(RE,{component:null,exit:!0,children:l})}))});function bY(e){return Ot("MuiButtonBase",e)}const EY=vt("MuiButtonBase",["root","disabled","focusVisible"]),SY=["action","centerRipple","children","className","component","disabled","disableRipple","disableTouchRipple","focusRipple","focusVisibleClassName","LinkComponent","onBlur","onClick","onContextMenu","onDragLeave","onFocus","onFocusVisible","onKeyDown","onKeyUp","onMouseDown","onMouseLeave","onMouseUp","onTouchEnd","onTouchMove","onTouchStart","tabIndex","TouchRippleProps","touchRippleRef","type"],TY=e=>{const{disabled:t,focusVisible:n,focusVisibleClassName:r,classes:o}=e,s=$t({root:["root",t&&"disabled",n&&"focusVisible"]},bY,o);return n&&r&&(s.root+=` ${r}`),s},kY=Me("button",{name:"MuiButtonBase",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${EY.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),Ul=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiButtonBase"}),{action:o,centerRipple:i=!1,children:s,className:a,component:l="button",disabled:c=!1,disableRipple:u=!1,disableTouchRipple:d=!1,focusRipple:p=!1,LinkComponent:m="a",onBlur:h,onClick:w,onContextMenu:v,onDragLeave:f,onFocus:g,onFocusVisible:y,onKeyDown:_,onKeyUp:E,onMouseDown:S,onMouseLeave:k,onMouseUp:C,onTouchEnd:O,onTouchMove:U,onTouchStart:T,tabIndex:A=0,TouchRippleProps:L,touchRippleRef:j,type:q}=r,K=xe(r,SY),J=P.useRef(null),z=P.useRef(null),Z=Lr(z,j),{isFocusVisibleRef:W,onFocus:$,onBlur:G,ref:D}=nO(),[x,I]=P.useState(!1);c&&x&&I(!1),P.useImperativeHandle(o,()=>({focusVisible:()=>{I(!0),J.current.focus()}}),[]);const[F,ne]=P.useState(!1);P.useEffect(()=>{ne(!0)},[]);const re=F&&!u&&!c;P.useEffect(()=>{x&&p&&!u&&F&&z.current.pulsate()},[u,p,x,F]);function be(Pe,qg,dfe=d){return Dl(e2=>(qg&&qg(e2),!dfe&&z.current&&z.current[Pe](e2),!0))}const $e=be("start",S),it=be("stop",v),er=be("stop",f),gn=be("stop",C),yr=be("stop",Pe=>{x&&Pe.preventDefault(),k&&k(Pe)}),ta=be("start",T),os=be("stop",O),is=be("stop",U),na=be("stop",Pe=>{G(Pe),W.current===!1&&I(!1),h&&h(Pe)},!1),ra=Dl(Pe=>{J.current||(J.current=Pe.currentTarget),$(Pe),W.current===!0&&(I(!0),y&&y(Pe)),g&&g(Pe)}),Mn=()=>{const Pe=J.current;return l&&l!=="button"&&!(Pe.tagName==="A"&&Pe.href)},zr=P.useRef(!1),ss=Dl(Pe=>{p&&!zr.current&&x&&z.current&&Pe.key===" "&&(zr.current=!0,z.current.stop(Pe,()=>{z.current.start(Pe)})),Pe.target===Pe.currentTarget&&Mn()&&Pe.key===" "&&Pe.preventDefault(),_&&_(Pe),Pe.target===Pe.currentTarget&&Mn()&&Pe.key==="Enter"&&!c&&(Pe.preventDefault(),w&&w(Pe))}),as=Dl(Pe=>{p&&Pe.key===" "&&z.current&&x&&!Pe.defaultPrevented&&(zr.current=!1,z.current.stop(Pe,()=>{z.current.pulsate(Pe)})),E&&E(Pe),w&&Pe.target===Pe.currentTarget&&Mn()&&Pe.key===" "&&!Pe.defaultPrevented&&w(Pe)});let Br=l;Br==="button"&&(K.href||K.to)&&(Br=m);const Gr={};Br==="button"?(Gr.type=q===void 0?"button":q,Gr.disabled=c):(!K.href&&!K.to&&(Gr.role="button"),c&&(Gr["aria-disabled"]=c));const No=Lr(n,D,J),di=N({},r,{centerRipple:i,component:l,disabled:c,disableRipple:u,disableTouchRipple:d,focusRipple:p,tabIndex:A,focusVisible:x}),oa=TY(di);return R.jsxs(kY,N({as:Br,className:Se(oa.root,a),ownerState:di,onBlur:na,onClick:w,onContextMenu:it,onFocus:ra,onKeyDown:ss,onKeyUp:as,onMouseDown:$e,onMouseLeave:yr,onMouseUp:gn,onDragLeave:er,onTouchEnd:os,onTouchMove:is,onTouchStart:ta,ref:No,tabIndex:c?-1:A,type:q},Gr,K,{children:[s,re?R.jsx(_Y,N({ref:Z,center:i},L)):null]}))});var xY=we.forwardRef((e,t)=>we.createElement($h,{...e,ref:t}));const ud=P.createContext({}),CY=["theme"];function IY(e){let{theme:t}=e,n=xe(e,CY);const r=t[zs];return R.jsx(RZ,N({},n,{themeId:r?zs:void 0,theme:r||t}))}const jl="&:hover,&:focus,&:active,&:visited",hr="__unstableAccessibleMain",si="__unstableAccessibleLight",PY="#524CFF",RY="#6B65FF",ai="0.75rem",dd="1.25em",Wl="1.25em",zE="1.25em",AY=.08,$Y="eui-rtl",pO=4,fO=[0,1,1,1,1],BE=(e,...t)=>{const n={...e};return n.shape={borderRadius:pO,__unstableBorderRadiusMultipliers:fO,...n.shape},_E(n,...t)};function OY(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const NY=e=>OY(e)&&e!=="classes",LY=BE({}),MY=W1({themeId:zs,defaultTheme:LY,rootShouldForwardProp:NY}),GE=(e,t)=>MY(e,t),DY="#000000",Nn="#FFFFFF",Lh="#f1f3f3",Mh="#d5d8dc",Dh="#babfc5",pd="#9da5ae",HE="#818a96",Uh="#69727d",jh="#515962",Fl="#3f444b",fd="#1f2124",hn="#0c0d0e",Wh="#f3bafd",Fh="#f0abfc",zh="#eb8efb",mO="#ef4444",hO="#dc2626",gO="#b91c1c",UY="#fbbf24",jY="#f59e0b",WY="#d97706",FY="#bb5b1d",yO="#b15211",wO="#3b82f6",vO="#2563eb",_O="#1d4ed8",bO="#10b981",EO="#0a875a",SO="#047857",Bh="#99f6e4",Gh="#5eead4",Hh="#2adfcd",qh="#b51243",Vh="#93003f",Kh="#7e013b",zY={styleOverrides:{root:({theme:e})=>({backgroundColor:e.palette.background.default,"&:before":{content:"none"},"&.Mui-expanded":{margin:0},"&.MuiAccordion-gutters + .MuiAccordion-root.MuiAccordion-gutters":{marginTop:e.spacing(1),marginBottom:e.spacing(0)},"&:not(.MuiAccordion-gutters) + .MuiAccordion-root:not(.MuiAccordion-gutters)":{borderTop:0},"&.Mui-disabled":{backgroundColor:e.palette.background.default}})},variants:[{props:{square:!1},style:({theme:e})=>{const t=e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[3];return{"&:first-of-type":{borderTopLeftRadius:t,borderTopRightRadius:t},"&:last-of-type":{borderBottomLeftRadius:t,borderBottomRightRadius:t}}}}]},BY={styleOverrides:{root:({theme:e})=>({padding:e.spacing(2)})}},GY={styleOverrides:{root:()=>({minHeight:"64px"}),content:({theme:e})=>({margin:e.spacing(1,0),"&.MuiAccordionSummary-content.Mui-expanded":{margin:e.spacing(1,0)}})}},HY={styleOverrides:{root:({theme:e})=>({padding:e.spacing(1,0)})}},qY={styleOverrides:{root:({theme:e})=>({marginTop:0,marginBottom:0,padding:e.spacing(1,0)})}},VY={styleOverrides:{listbox:({theme:e})=>({"&.MuiAutocomplete-listboxSizeTiny":{fontSize:"0.875rem"},'&.MuiAutocomplete-listbox .MuiAutocomplete-option[aria-selected="true"]':{"&,&.Mui-Mui-focused":{backgroundColor:e.palette.action.selected}}})},variants:[{props:{size:"tiny"},style:()=>({"& .MuiOutlinedInput-root":{padding:"2.5px 0","& .MuiAutocomplete-input":{lineHeight:Wl,height:Wl,padding:"4px 2px 4px 8px"}},"& .MuiFilledInput-root":{padding:0,"& .MuiAutocomplete-input":{padding:"15px 8px 6px"}},"& .MuiInput-root":{paddingBottom:0,"& .MuiAutocomplete-input":{padding:"2px 0"}},"& .MuiAutocomplete-popupIndicator":{fontSize:"1.5em"},"& .MuiAutocomplete-clearIndicator":{fontSize:"1.2em"},"& .MuiAutocomplete-popupIndicator .MuiSvgIcon-root, & .MuiAutocomplete-clearIndicator .MuiSvgIcon-root":{fontSize:"1em"},"& .MuiInputAdornment-root .MuiIconButton-root":{padding:"2px"},"& .MuiAutocomplete-tagSizeTiny":{fontSize:ai},"&.MuiAutocomplete-hasPopupIcon.MuiAutocomplete-hasClearIcon .MuiOutlinedInput-root .MuiAutocomplete-input":{paddingRight:"48px"}})},{props:{size:"tiny",multiple:!0},style:()=>({"& .MuiAutocomplete-tag":{margin:"1.5px 3px"}})}]},KY={variants:[{props:{variant:"rounded"},style:({theme:e})=>({borderRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[1]})}]},ZY={styleOverrides:{root:({theme:e})=>({borderRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[2],boxShadow:"none",whiteSpace:"nowrap","&:hover":{boxShadow:"none"},"& .MuiSvgIcon-root":{fill:"currentColor"}})},variants:[{props:{color:"primary",variant:"outlined"},style:({theme:e})=>({color:e.palette.primary.__unstableAccessibleMain,borderColor:e.palette.primary.__unstableAccessibleMain,"&:hover":{borderColor:e.palette.primary.__unstableAccessibleMain}})},{props:{color:"primary",variant:"text"},style:({theme:e})=>({color:e.palette.primary.__unstableAccessibleMain})},{props:{color:"global",variant:"outlined"},style:({theme:e})=>({color:e.palette.global.__unstableAccessibleMain,borderColor:e.palette.global.__unstableAccessibleMain,"&:hover":{borderColor:e.palette.global.__unstableAccessibleMain}})},{props:{color:"global",variant:"text"},style:({theme:e})=>({color:e.palette.global.__unstableAccessibleMain})}]},YY={styleOverrides:{root:()=>({"&.MuiButtonBase-root.Mui-focusVisible":{boxShadow:"0 0 0 1px inset"},".MuiCircularProgress-root":{fontSize:"inherit"}})}},TO=["primary","secondary","error","warning","info","success","accent","global","promotion","decorative","neutral"],qE=["primary","global"],JY=TO.filter(e=>!qE.includes(e)),XY={styleOverrides:{root:()=>({boxShadow:"none","&:hover":{boxShadow:"none"}})},variants:TO.map(e=>({props:{variant:"contained",color:e},style:({theme:t})=>({"& .MuiButtonGroup-grouped:not(:last-of-type), & .MuiButtonGroup-grouped:not(:last-of-type).Mui-disabled":{borderRight:0},"& .MuiButtonGroup-grouped:not(:last-child), & > *:not(:last-child) .MuiButtonGroup-grouped":{borderRight:`1px solid ${t.palette[e].dark}`},"& .MuiButtonGroup-grouped:not(:last-child).Mui-disabled, & > *:not(:last-child) .MuiButtonGroup-grouped.Mui-disabled":{borderRight:`1px solid ${t.palette.action.disabled}`}})}))},QY={defaultProps:{},styleOverrides:{root:()=>({position:"relative"})}},eJ={styleOverrides:{root:({theme:e})=>({justifyContent:"flex-end",padding:e.spacing(1.5,2)})}},tJ={styleOverrides:{root:()=>({"& .MuiCard-root.MuiPaper-outlined:not(:last-child)":{borderBottom:0},"& .MuiCard-root.MuiPaper-rounded":{"&:first-child:not(:last-child)":{borderBottomRightRadius:0,borderBottomLeftRadius:0},"&:not(:first-child):not(:last-child)":{borderRadius:0},"&:last-child:not(:first-child)":{borderTopRightRadius:0,borderTopLeftRadius:0}}})}},nJ={styleOverrides:{action:()=>({alignSelf:"center"})}},rJ={variants:[{props:{color:"primary",variant:"outlined"},style:({theme:e})=>({color:e.palette.primary.__unstableAccessibleMain,borderColor:e.palette.primary.__unstableAccessibleMain,"& .MuiChip-deleteIcon":{color:e.palette.primary.__unstableAccessibleLight,"&:hover":{color:e.palette.primary.__unstableAccessibleMain}}})},{props:{color:"global",variant:"outlined"},style:({theme:e})=>({color:e.palette.global.__unstableAccessibleMain,borderColor:e.palette.global.__unstableAccessibleMain,"& .MuiChip-deleteIcon":{color:e.palette.global.__unstableAccessibleLight,"&:hover":{color:e.palette.global.__unstableAccessibleMain}}})},{props:{color:"default",variant:"filled"},style:({theme:e})=>({backgroundColor:e.palette.mode==="light"?"#EBEBEB":"#434547","&.Mui-focusVisible, &.MuiChip-clickable:hover":{backgroundColor:e.palette.action.focus},"& .MuiChip-icon":{color:"inherit"}})},...VE(["default"],oJ),...VE(["primary","global"],iJ),...VE(JY,sJ),{props:{size:"tiny"},style:()=>({fontSize:ai,height:"20px",paddingInline:"5px","& .MuiChip-avatar":{width:"1rem",height:"1rem",fontSize:"9px",marginLeft:0,marginRight:"1px"},"& .MuiChip-icon":{fontSize:"1rem",marginLeft:0,marginRight:0},"& .MuiChip-label":{paddingRight:"3px",paddingLeft:"3px"},"& .MuiChip-deleteIcon":{fontSize:"0.875rem",marginLeft:0,marginRight:0}})},{props:{size:"small"},style:()=>({height:"24px",paddingInline:"5px","& .MuiChip-avatar":{width:"1.125rem",height:"1.125rem",fontSize:"9px",marginLeft:0,marginRight:"2px"},"& .MuiChip-icon":{fontSize:"1.125rem",marginLeft:0,marginRight:0},"& .MuiChip-label":{paddingRight:"3px",paddingLeft:"3px"},"& .MuiChip-deleteIcon":{fontSize:"1rem",marginLeft:0,marginRight:0}})},{props:{size:"medium"},style:()=>({height:"32px",paddingInline:"6px","& .MuiChip-avatar":{width:"1.25rem",height:"1.25rem",fontSize:"0.75rem",marginLeft:0,marginRight:"2px"},"& .MuiChip-icon":{fontSize:"1.25rem",marginLeft:0,marginRight:0},"& .MuiChip-label":{paddingRight:"4px",paddingLeft:"4px"},"& .MuiChip-deleteIcon":{fontSize:"1.125rem",marginLeft:0,marginRight:0}})}]};function VE(e,t){return e.map(n=>({props:{color:n,variant:"standard"},style:({theme:r})=>{const o=t(r,n),{mode:i}=r.palette;return{backgroundColor:o.backgroundColor[i],color:o.color[i],"&.Mui-focusVisible, &.MuiChip-clickable:hover":{backgroundColor:o.backgroundColorHover[i]},"& .MuiChip-icon":{color:"inherit"},"& .MuiChip-deleteIcon":{color:o.color[i],opacity:o.deleteIconOpacity,"&:hover,&:focus":{color:o.color[i],opacity:o.deleteIconOpacityHover}}}}}))}function oJ(e){return{backgroundColor:{light:"#EBEBEB",dark:"#434547"},backgroundColorHover:{light:e.palette.action.focus,dark:e.palette.action.focus},color:{light:e.palette.text.primary,dark:e.palette.text.primary},deleteIconOpacity:.26,deleteIconOpacityHover:.7}}function iJ(e,t){const n=e.palette[t];return{backgroundColor:{light:Ll(n.light,.8),dark:Nl(n.__unstableAccessibleMain,.8)},backgroundColorHover:{light:Ll(n.light,.6),dark:Nl(n.__unstableAccessibleMain,.9)},color:{light:Nl(n.__unstableAccessibleMain,.3),dark:Ll(n.light,.3)},deleteIconOpacity:.7,deleteIconOpacityHover:1}}function sJ(e,t){return{backgroundColor:{light:Ll(e.palette[t].light,.9),dark:Nl(e.palette[t].light,.8)},backgroundColorHover:{light:Ll(e.palette[t].light,.8),dark:Nl(e.palette[t].light,.9)},color:{light:Nl(e.palette[t].main,.3),dark:Ll(e.palette[t].main,.5)},deleteIconOpacity:.7,deleteIconOpacityHover:1}}const aJ={styleOverrides:{root:({theme:e})=>({fontSize:e.spacing(5)})}},lJ={styleOverrides:{paper:({theme:e})=>({borderRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[4]})}},cJ={styleOverrides:{root:({theme:e})=>({padding:e.spacing(2,3)})}},uJ={styleOverrides:{dividers:()=>({"&:last-child":{borderBottom:"none"}})}},dJ={styleOverrides:{root:({theme:e})=>({borderTopLeftRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[2],borderTopRightRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[2]})},variants:[{props:{size:"tiny"},style:({theme:e})=>({fontSize:ai,lineHeight:zE,"& .MuiInputBase-input":{fontSize:ai,lineHeight:zE,height:zE,padding:"15px 8px 6px"},"&.MuiInputBase-adornedStart":{paddingLeft:e.spacing(1)},"&.MuiInputBase-adornedEnd":{paddingRight:e.spacing(1)},"& .MuiInputAdornment-root.MuiInputAdornment-positionStart:not(.MuiInputAdornment-hiddenLabel)":{marginTop:e.spacing(1)},"& .MuiInputAdornment-root:not(.MuiInputAdornment-positionEnd)":{marginRight:0},"& .MuiInputAdornment-root.MuiInputAdornment-positionEnd":{marginLeft:0}})},{props:{size:"tiny",multiline:!0},style:()=>({padding:0})}]},pJ={styleOverrides:{root:({theme:e})=>({color:e.palette.text.tertiary,margin:e.spacing(.5,0,0)})}},fJ={variants:[{props:{size:"tiny"},style:()=>({fontSize:"0.75rem",lineHeight:"1.6",fontWeight:"400",letterSpacing:"0.19px"})},{props:{size:"small"},style:({theme:e})=>({...e.typography.body2})}]},mJ={variants:[{props:{color:"primary"},style:({theme:e})=>({color:e.palette.primary.__unstableAccessibleMain})},{props:{color:"global"},style:({theme:e})=>({color:e.palette.global.__unstableAccessibleMain})},{props:{edge:"start",size:"small"},style:({theme:e})=>({marginLeft:e.spacing(-1.5)})},{props:{edge:"end",size:"small"},style:({theme:e})=>({marginRight:e.spacing(-1.5)})},{props:{edge:"start",size:"large"},style:({theme:e})=>({marginLeft:e.spacing(-2)})},{props:{edge:"end",size:"large"},style:({theme:e})=>({marginRight:e.spacing(-2)})},{props:{size:"tiny"},style:({theme:e})=>({padding:e.spacing(.75)})},{props:{size:"tiny",edge:"start"},style:({theme:e})=>({marginLeft:e.spacing(-1)})},{props:{size:"tiny",edge:"end"},style:({theme:e})=>({marginRight:e.spacing(-1)})}]},hJ={variants:[{props:{size:"tiny"},style:({theme:e})=>({fontSize:ai,lineHeight:dd,"&.MuiInput-root":{marginTop:e.spacing(1.5)},"& .MuiInputBase-input":{fontSize:ai,lineHeight:dd,height:dd,padding:"6.5px 0"}})}]},gJ={styleOverrides:{root:({theme:e})=>({"&.MuiInputAdornment-sizeTiny":{"&.MuiInputAdornment-positionStart":{marginRight:e.spacing(.5)},"&.MuiInputAdornment-positionEnd":{marginLeft:e.spacing(.5)}}})}},yJ={styleOverrides:{input:()=>({".MuiInputBase-root.Mui-disabled &":{backgroundColor:"initial"}})}},wJ={variants:[{props:{size:"tiny",shrink:!1},style:()=>({"&.MuiInputLabel-outlined":{transform:"translate(7.5px, 5.5px) scale(1)"},"&.MuiInputLabel-standard":{transform:"translate(0px, 18px) scale(1)"},"&.MuiInputLabel-filled":{transform:"translate(8px, 11px) scale(1)"}})},{props:{size:"tiny",shrink:!0},style:()=>({"&.MuiInputLabel-filled":{transform:"translate(8px, 2px) scale(0.75)"}})}]},vJ={styleOverrides:{root:({theme:e})=>({color:e.palette.text.primary,"a&":{[jl]:{color:e.palette.text.primary}}})}},_J={styleOverrides:{root:({theme:e})=>({color:e.palette.text.primary,"&.Mui-selected":{backgroundColor:e.palette.action.selected,"&:hover":{backgroundColor:e.palette.action.selected},"&:focus":{backgroundColor:e.palette.action.focus}},"a&":{[jl]:{color:e.palette.text.primary}}})}},bJ={styleOverrides:{root:({theme:e})=>({minWidth:"initial","&:not(:last-child)":{marginRight:e.spacing(1)}})}},EJ={styleOverrides:{root:({theme:e})=>({color:e.palette.text.primary})}},SJ="linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.12))",TJ={variants:[{props:{square:!1},style:({theme:e})=>({borderRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[3]})}]},kJ={styleOverrides:{root:({theme:e})=>({backgroundImage:SJ,lineHeight:"36px",color:e.palette.text.secondary})}},xJ={styleOverrides:{root:({theme:e})=>({"&.Mui-selected":{backgroundColor:e.palette.action.selected,"&:hover":{backgroundColor:e.palette.action.selected},"&:focus":{backgroundColor:e.palette.action.focus}},"a&":{[jl]:{color:e.palette.text.primary}},"& .MuiListItemIcon-root":{minWidth:"initial"}})}},CJ={styleOverrides:{root:({theme:e})=>({borderRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[2],"&.Mui-focused .MuiInputAdornment-root .MuiOutlinedInput-notchedOutline":{borderColor:e.palette.mode==="dark"?"rgba(255, 255, 255, 0.23)":"rgba(0, 0, 0, 0.23)",borderWidth:"1px"}})},variants:[{props:{size:"tiny"},style:({theme:e})=>({fontSize:ai,lineHeight:Wl,"&.MuiInputBase-adornedStart":{paddingLeft:e.spacing(1)},"&.MuiInputBase-adornedEnd":{paddingRight:e.spacing(1)},"& .MuiInputBase-input":{fontSize:ai,lineHeight:Wl,height:Wl,padding:"6.5px 8px"},"& .MuiInputAdornment-root + .MuiInputBase-input":{paddingLeft:0},"&:has(.MuiInputBase-input + .MuiInputAdornment-root) .MuiInputBase-input":{paddingRight:0}})},{props:{size:"tiny",multiline:!0},style:()=>({padding:0})},{props:e=>!!e.endAdornment&&e.size==="tiny",style:()=>({"& .MuiInputAdornment-root .MuiInputBase-root .MuiSelect-select":{"&.MuiSelect-standard":{paddingTop:0,paddingBottom:0},"&.MuiSelect-outlined,&.MuiSelect-filled":{paddingTop:"4px",paddingBottom:"4px"}}})},{props:e=>!!e.endAdornment&&e.size==="small",style:()=>({"& .MuiInputAdornment-root .MuiInputBase-root .MuiSelect-select":{paddingTop:"2.5px",paddingBottom:"2.5px"}})},{props:e=>!!e.endAdornment&&(e.size==="medium"||!e.size),style:()=>({"& .MuiInputAdornment-root .MuiInputBase-root .MuiSelect-select":{paddingTop:"8.5px",paddingBottom:"8.5px"}})}]},IJ={variants:[{props:{shape:"rounded"},style:({theme:e})=>({borderRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[1]})}]},kO="1rem",xO="9px",PJ={styleOverrides:{nativeInput:()=>({".MuiInputBase-root.Mui-disabled &":{backgroundColor:"initial",opacity:0}})},variants:[{props:{size:"tiny"},style:()=>({"& .MuiSelect-icon":{fontSize:kO,right:xO},"& .MuiSelect-select.MuiSelect-outlined, & .MuiSelect-select.MuiSelect-filled":{minHeight:Wl},"& .MuiSelect-select.MuiSelect-standard":{lineHeight:dd,minHeight:dd}})}]},RJ={variants:[{props:{variant:"rounded"},style:({theme:e})=>({borderRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[1]})}]},AJ={defaultProps:{},styleOverrides:{root:({theme:e})=>({borderRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[2]})}},$J={styleOverrides:{root:({theme:e})=>({"& .MuiStepConnector-line":{borderColor:e.palette.divider}})}},OJ={styleOverrides:{root:({theme:e})=>({"&:not(.Mui-active) .MuiStepIcon-text":{fill:e.palette.common.white}})}},NJ={styleOverrides:{root:()=>({alignItems:"flex-start"})}},LJ={styleOverrides:{root:()=>({"& .MuiStepLabel-root":{alignItems:"center"}})}},MJ={variants:[{props:{fontSize:"tiny"},style:()=>({fontSize:"1rem"})}]},md=32,CO=1.6,IO="0.75rem",PO=.75,RO=1,AO=72;var KE={MuiAccordion:zY,MuiAccordionActions:BY,MuiAccordionSummary:GY,MuiAccordionSummaryIcon:HY,MuiAccordionSummaryText:qY,MuiAutocomplete:VY,MuiAvatar:KY,MuiButton:ZY,MuiButtonBase:YY,MuiButtonGroup:XY,MuiCard:QY,MuiCardActions:eJ,MuiCardGroup:tJ,MuiCardHeader:nJ,MuiChip:rJ,MuiCircularProgress:aJ,MuiDialog:lJ,MuiDialogActions:cJ,MuiDialogContent:uJ,MuiFilledInput:dJ,MuiFormHelperText:pJ,MuiFormLabel:fJ,MuiIconButton:mJ,MuiInput:hJ,MuiInputAdornment:gJ,MuiInputBase:yJ,MuiInputLabel:wJ,MuiListItem:vJ,MuiListItemButton:_J,MuiListItemIcon:bJ,MuiListItemText:EJ,MuiListSubheader:kJ,MuiMenuItem:xJ,MuiOutlinedInput:CJ,MuiPagination:IJ,MuiPaper:TJ,MuiSelect:PJ,MuiSkeleton:RJ,MuiSnackbarContent:AJ,MuiStepConnector:$J,MuiStepIcon:OJ,MuiStepLabel:NJ,MuiStepper:LJ,MuiSvgIcon:MJ,MuiTab:{styleOverrides:{root:{"&:not(.Mui-selected)":{fontWeight:400},"&.Mui-selected":{fontWeight:700}}},variants:[{props:{size:"small"},style:({theme:e})=>({fontSize:IO,lineHeight:CO,padding:e.spacing(PO,RO),minWidth:AO,"&:not(.MuiTab-labelIcon)":{minHeight:md},"&.MuiTab-labelIcon":{minHeight:md}})}]},MuiTableRow:{styleOverrides:{root:({theme:e})=>({"&.Mui-selected":{backgroundColor:e.palette.action.selected,"&:hover":{backgroundColor:e.palette.action.selected}}})},variants:[{props:e=>"onClick"in e,style:()=>({cursor:"pointer"})}]},MuiTabPanel:{styleOverrides:{root:({theme:e})=>({color:e.palette.text.primary})}},MuiTabs:{styleOverrides:{indicator:{height:"3px"}},variants:[{props:{size:"small"},style:({theme:e})=>({minHeight:md,"& .MuiTab-root":{fontSize:IO,lineHeight:CO,padding:e.spacing(PO,RO),minWidth:AO,"&:not(.MuiTab-labelIcon)":{minHeight:md},"&.MuiTab-labelIcon":{minHeight:md}}})}]},MuiTextField:{styleOverrides:{root:({theme:e})=>({borderRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[2],"& legend":{transition:"unset"}})},variants:[{props:{size:"tiny",select:!0},style:()=>({"& .MuiSelect-icon":{fontSize:kO,right:xO},"& .MuiInputBase-root .MuiSelect-select":{minHeight:"auto"}})}]},MuiToggleButton:{styleOverrides:{root:({theme:e})=>({borderRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[2]})},variants:[{props:{color:"primary"},style:({theme:e})=>({"&.MuiToggleButton-root.Mui-selected":{color:e.palette.primary.__unstableAccessibleMain}})},{props:{color:"global"},style:({theme:e})=>({"&.MuiToggleButton-root.Mui-selected":{color:e.palette.global.__unstableAccessibleMain}})},{props:{size:"tiny"},style:({theme:e})=>({fontSize:ai,lineHeight:1.3334,padding:e.spacing(.625)})}]},MuiTooltip:{styleOverrides:{arrow:({theme:e})=>({color:e.palette.grey[700]}),tooltip:({theme:e})=>({backgroundColor:e.palette.grey[700],borderRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[1]})}}};const ZE={components:KE,shape:{borderRadius:pO,__unstableBorderRadiusMultipliers:fO},typography:{display1:{fontSize:"0rem"},display2:{fontSize:"0rem"},display3:{fontSize:"0rem"},display4:{fontSize:"0rem"},display5:{fontSize:"0rem"},display6:{fontSize:"0rem"},button:{textTransform:"none"},h1:{fontWeight:700},h2:{fontWeight:700},h3:{fontSize:"2.75rem",fontWeight:700},h4:{fontSize:"2rem",fontWeight:700},h5:{fontWeight:700},subtitle1:{fontWeight:500,lineHeight:1.3},subtitle2:{lineHeight:1.3}},zIndex:{mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500}},$O={...ZE,palette:{mode:"light",primary:{main:Fh,light:Wh,dark:zh,contrastText:hn,[hr]:"#C00BB9",[si]:"#D355CE"},secondary:{main:jh,light:Uh,dark:Fl,contrastText:Nn},grey:{50:Lh,100:Mh,200:Dh,300:pd,400:HE,500:Uh,600:jh,700:Fl,800:fd,900:hn},text:{primary:hn,secondary:Fl,tertiary:Uh,disabled:pd},background:{paper:Nn,default:Nn},success:{main:EO,light:bO,dark:SO,contrastText:Nn},error:{main:hO,light:mO,dark:gO,contrastText:Nn},warning:{main:FY,light:WY,dark:yO,contrastText:Nn},info:{main:vO,light:wO,dark:_O,contrastText:Nn},global:{main:Gh,light:Bh,dark:Hh,contrastText:hn,[hr]:"#17929B",[si]:"#5DB3B9"},accent:{main:Vh,light:qh,dark:Kh,contrastText:Nn},promotion:{main:Vh,light:qh,dark:Kh,contrastText:Nn},decorative:{main:Gh,light:Bh,dark:Hh,contrastText:hn},neutral:{main:"#ffffff",light:"#ffffff",dark:"#ffffff",contrastText:"#ffffff"}}},OO={...ZE,palette:{mode:"dark",primary:{main:Fh,light:Wh,dark:zh,contrastText:hn,[hr]:"#C00BB9",[si]:"#D355CE"},secondary:{main:pd,light:Dh,dark:HE,contrastText:hn},grey:{50:Lh,100:Mh,200:Dh,300:pd,400:HE,500:Uh,600:jh,700:Fl,800:fd,900:hn},text:{primary:Nn,secondary:Dh,tertiary:pd,disabled:jh},background:{paper:hn,default:fd},success:{main:EO,light:bO,dark:SO,contrastText:Nn},error:{main:hO,light:mO,dark:gO,contrastText:Nn},warning:{main:jY,light:UY,dark:yO,contrastText:DY},info:{main:vO,light:wO,dark:_O,contrastText:Nn},global:{main:Gh,light:Bh,dark:Hh,contrastText:hn,[hr]:"#17929B",[si]:"#5DB3B9"},accent:{main:Vh,light:qh,dark:Kh,contrastText:Nn},promotion:{main:Vh,light:qh,dark:Kh,contrastText:Nn},decorative:{main:Gh,light:Bh,dark:Hh,contrastText:hn},neutral:{main:"#ffffff",light:"#ffffff",dark:"#ffffff",contrastText:"#ffffff"}}},NO="#524CFF";var DJ={primary:{main:NO,light:"#6B65FF",dark:"#4C43E5",contrastText:"#FFFFFF",[hr]:PY,[si]:RY},action:{selected:NE(NO,AY)}};const LO=fd,MO=Fl;var UJ={primary:{main:LO,light:MO,dark:hn,contrastText:"#FFFFFF",[hr]:LO,[si]:MO},accent:{main:Fh,light:Wh,dark:zh,contrastText:hn}};const DO=Lh,UO="#FFFFFF";var jJ={primary:{main:DO,light:UO,dark:Mh,contrastText:hn,[hr]:DO,[si]:UO},accent:{main:Fh,light:Wh,dark:zh,contrastText:hn}};const jO=fd,WO=Fl;var WJ={primary:{main:jO,light:WO,dark:hn,contrastText:"#FFFFFF",[hr]:jO,[si]:WO},accent:{main:"#f00",light:"#f00",dark:"#f00",contrastText:"#f00"},decorative:{main:"#f00",light:"#f00",dark:"#f00",contrastText:"#f00"},neutral:{main:"#f00",light:"#f00",dark:"#f00",contrastText:"#f00"}};const FO=Lh,zO="#FFFFFF";var FJ={primary:{main:FO,light:zO,dark:Mh,contrastText:hn,[hr]:FO,[si]:zO},accent:{main:"#f00",light:"#f00",dark:"#f00",contrastText:"#f00"},decorative:{main:"#f00",light:"#f00",dark:"#f00",contrastText:"#f00"},neutral:{main:"#f00",light:"#f00",dark:"#f00",contrastText:"#f00"}};const BO=P.createContext(null),zJ=({value:e,children:t})=>P.createElement(BO.Provider,{value:e},t),BJ=()=>P.useContext(BO),GJ={zIndex:ZE.zIndex};function HJ(e,t){if(!e)return t;if(typeof e!="function")return console.error("overrides must be a function"),t;const n=e(structuredClone(t||GJ));return!n||typeof n!="object"?(console.error("overrides function must return an object"),t):n}const qJ=["variants"];function VJ(e,t,n){const r=Zi(e,t,{clone:!0});if(n==="replace")return r;const o=t,i=e,s=r;for(const a of Object.keys(o)){const l=o[a],c=i[a],u=s[a];if(!(!l||!u))for(const d of qJ){const p=l[d];if(!Array.isArray(p))continue;const m=c==null?void 0:c[d],h=Array.isArray(m)?m:[];u[d]=[...h,...p]}}return r}function KJ(e,t){const{options:n,components:r,palette:o,shadows:i,shape:s,typography:a,zIndex:l}=e,c={components:r?VJ(KE,r,(n==null?void 0:n.componentVariantsMerge)??"concat"):KE};return t&&(o!=null&&o.dark)?c.palette={...OO.palette,...HO(o.dark),mode:"dark"}:o!=null&&o.light&&(c.palette={...$O.palette,...HO(o.light)}),i&&(c.shadows=i),s&&(c.shape=s),a&&(c.typography=ZJ(a)),l&&(c.zIndex=l),c}const GO=!0;function ZJ(e={}){return e?qO(e,{fontFamily:GO,display1:["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing"],display2:["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing"],display3:["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing"],display4:["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing"],display5:["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing"],display6:["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing"],h1:["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing"],h2:["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing"],h3:["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing"],h4:["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing"],h5:["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing"],h6:["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing"],subtitle1:["fontFamily"],subtitle2:["fontFamily"],body1:["fontFamily"],body2:["fontFamily"],caption:["fontFamily"],overline:["fontFamily"],button:["fontFamily","textTransform"]}):{}}function HO(e){return e?qO(e,{primary:["main","light","dark","contrastText","__unstableAccessibleMain","__unstableAccessibleLight","__unstableTonalMain","__unstableTonalDark","__unstableSurface","__unstableSurfaceMain","__unstableSurfaceLight","__unstableSurfaceDark","__unstableSurfaceTranslucent"],secondary:["main","light","dark","contrastText","__unstableAccessibleMain","__unstableAccessibleLight","__unstableTonalMain","__unstableTonalDark","__unstableSurface","__unstableSurfaceMain","__unstableSurfaceLight","__unstableSurfaceDark","__unstableSurfaceTranslucent"],success:["main","light","dark","contrastText","__unstableAccessibleMain","__unstableAccessibleLight","__unstableTonalMain","__unstableTonalDark","__unstableSurface","__unstableSurfaceMain","__unstableSurfaceLight","__unstableSurfaceDark","__unstableSurfaceTranslucent"],info:["main","light","dark","contrastText","__unstableAccessibleMain","__unstableAccessibleLight","__unstableTonalMain","__unstableTonalDark","__unstableSurface","__unstableSurfaceMain","__unstableSurfaceLight","__unstableSurfaceDark","__unstableSurfaceTranslucent"],warning:["main","light","dark","contrastText","__unstableAccessibleMain","__unstableAccessibleLight","__unstableTonalMain","__unstableTonalDark","__unstableSurface","__unstableSurfaceMain","__unstableSurfaceLight","__unstableSurfaceDark","__unstableSurfaceTranslucent"],error:["main","light","dark","contrastText","__unstableAccessibleMain","__unstableAccessibleLight","__unstableTonalMain","__unstableTonalDark","__unstableSurface","__unstableSurfaceMain","__unstableSurfaceLight","__unstableSurfaceDark","__unstableSurfaceTranslucent"],background:["default","paper","__unstableSurface","__unstableSurfaceMain","__unstableSurfaceLight","__unstableSurfaceDark","__unstableSurfaceTranslucent"],decorative:["main","light","dark","contrastText","__unstableAccessibleMain","__unstableAccessibleLight","__unstableTonalMain","__unstableTonalDark","__unstableSurface","__unstableSurfaceMain","__unstableSurfaceLight","__unstableSurfaceDark","__unstableSurfaceTranslucent"],accent:["main","light","dark","contrastText","__unstableAccessibleMain","__unstableAccessibleLight","__unstableTonalMain","__unstableTonalDark","__unstableSurface","__unstableSurfaceMain","__unstableSurfaceLight","__unstableSurfaceDark","__unstableSurfaceTranslucent"],neutral:["main","light","dark","contrastText","__unstableAccessibleMain","__unstableAccessibleLight","__unstableTonalMain","__unstableTonalDark","__unstableSurface","__unstableSurfaceMain","__unstableSurfaceLight","__unstableSurfaceDark","__unstableSurfaceTranslucent"],text:["primary","secondary","tertiary","disabled"],action:["active","focus","hover","disabled","disabledBackground","selected","__unstableGradientAngle"],divider:GO}):{}}function qO(e,t){if(!e||!t)return{};const n={};return Object.entries(t).forEach(([r,o])=>{if(!!!e[r])return;if(typeof o=="boolean"){n[r]=e[r];return}if(Array.isArray(o)){const l=e[r];o.forEach(c=>{(l==null?void 0:l[c])!==void 0&&(n[r]={...n[r],[c]:l[c]})})}}),n}const zl=new Map,YJ=(e,t=!1,n=!1)=>{if(!e.name)throw new Error("Custom theme must have a name");const o=`${e.name}-${t}-${n}`;if(zl.has(o))return zl.get(o);const i={typography:{subtitle1:{fontWeight:500,lineHeight:1.3},subtitle2:{lineHeight:1.3}}};n&&(i.direction="rtl");const s=KJ(e,t),a=BE(s,i);return zl.set(o,a),a},JJ=({palette:e="default",rtl:t=!1,isDarkMode:n=!1}={})=>{const r=`${e}-${n}-${t}`;if(zl.has(r))return zl.get(r);const o=n?OO:$O,i={};e==="marketing-suite"&&(i.palette=DJ),e==="unstable"&&(i.palette=n?jJ:UJ,i.shape={borderRadius:8,__unstableBorderRadiusMultipliers:[0,.5,1,1.5,2.5]}),e==="argon-beta"&&(i.palette=n?FJ:WJ,i.shape={borderRadius:8,__unstableBorderRadiusMultipliers:[0,.5,1,1.5,2.5]}),t&&(i.direction="rtl");const s=BE(o,i);return zl.set(r,s),s},XJ=(e,t)=>{if(!t)return e;const n=["zIndex"],r={};return n.forEach(o=>{o in t&&(r[o]=t[o])}),Zi(e,r,{clone:!0})},Zh=ah(({colorScheme:e,palette:t,children:n,overrides:r,unstableThemeV0:o},i)=>{const s=BJ(),a=i.key===$Y,l=e||(s==null?void 0:s.colorScheme)||"auto",c=vZ("(prefers-color-scheme: dark)"),u=l==="auto"&&c||l==="dark",d=HJ(r,s==null?void 0:s.overrides),p=(o==null?void 0:o.name)||t||(s==null?void 0:s.themeName),m=o||(s==null?void 0:s.customTheme);let h=m?YJ(m,u,a):JJ({rtl:a,isDarkMode:u,palette:t||(s==null?void 0:s.themeName)});return d&&(h=XJ(h,d)),we.createElement(zJ,{value:{colorScheme:e,themeName:p,overrides:d,customTheme:m}},we.createElement(IY,{theme:h},n))});function QJ(e){return Ot("MuiTypography",e)}vt("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const eX=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],tX=e=>{const{align:t,gutterBottom:n,noWrap:r,paragraph:o,variant:i,classes:s}=e,a={root:["root",i,e.align!=="inherit"&&`align${ae(t)}`,n&&"gutterBottom",r&&"noWrap",o&&"paragraph"]};return $t(a,QJ,s)},nX=Me("span",{name:"MuiTypography",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.variant&&t[n.variant],n.align!=="inherit"&&t[`align${ae(n.align)}`],n.noWrap&&t.noWrap,n.gutterBottom&&t.gutterBottom,n.paragraph&&t.paragraph]}})(({theme:e,ownerState:t})=>N({margin:0},t.variant==="inherit"&&{font:"inherit"},t.variant!=="inherit"&&e.typography[t.variant],t.align!=="inherit"&&{textAlign:t.align},t.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},t.gutterBottom&&{marginBottom:"0.35em"},t.paragraph&&{marginBottom:16})),VO={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},rX={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},oX=e=>rX[e]||e,hd=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiTypography"}),o=oX(r.color),i=uh(N({},r,{color:o})),{align:s="inherit",className:a,component:l,gutterBottom:c=!1,noWrap:u=!1,paragraph:d=!1,variant:p="body1",variantMapping:m=VO}=i,h=xe(i,eX),w=N({},i,{align:s,color:o,className:a,component:l,gutterBottom:c,noWrap:u,paragraph:d,variant:p,variantMapping:m}),v=l||(d?"p":m[p]||VO[p])||"span",f=tX(w);return R.jsx(nX,N({as:v,ref:n,ownerState:w,className:Se(f.root,a)},h))});function iX(e){return Ot("MuiIconButton",e)}const sX=vt("MuiIconButton",["root","disabled","colorInherit","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","edgeStart","edgeEnd","sizeSmall","sizeMedium","sizeLarge"]),aX=["edge","children","className","color","disabled","disableFocusRipple","size"],lX=e=>{const{classes:t,disabled:n,color:r,edge:o,size:i}=e,s={root:["root",n&&"disabled",r!=="default"&&`color${ae(r)}`,o&&`edge${ae(o)}`,`size${ae(i)}`]};return $t(s,iX,t)},cX=Me(Ul,{name:"MuiIconButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${ae(n.color)}`],n.edge&&t[`edge${ae(n.edge)}`],t[`size${ae(n.size)}`]]}})(({theme:e,ownerState:t})=>N({textAlign:"center",flex:"0 0 auto",fontSize:e.typography.pxToRem(24),padding:8,borderRadius:"50%",overflow:"visible",color:(e.vars||e).palette.action.active,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest})},!t.disableRipple&&{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:wt(e.palette.action.active,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},t.edge==="start"&&{marginLeft:t.size==="small"?-3:-12},t.edge==="end"&&{marginRight:t.size==="small"?-3:-12}),({theme:e,ownerState:t})=>{var n;const r=(n=(e.vars||e).palette)==null?void 0:n[t.color];return N({},t.color==="inherit"&&{color:"inherit"},t.color!=="inherit"&&t.color!=="default"&&N({color:r==null?void 0:r.main},!t.disableRipple&&{"&:hover":N({},r&&{backgroundColor:e.vars?`rgba(${r.mainChannel} / ${e.vars.palette.action.hoverOpacity})`:wt(r.main,e.palette.action.hoverOpacity)},{"@media (hover: none)":{backgroundColor:"transparent"}})}),t.size==="small"&&{padding:5,fontSize:e.typography.pxToRem(18)},t.size==="large"&&{padding:12,fontSize:e.typography.pxToRem(28)},{[`&.${sX.disabled}`]:{backgroundColor:"transparent",color:(e.vars||e).palette.action.disabled}})}),uX=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiIconButton"}),{edge:o=!1,children:i,className:s,color:a="default",disabled:l=!1,disableFocusRipple:c=!1,size:u="medium"}=r,d=xe(r,aX),p=N({},r,{edge:o,color:a,disabled:l,disableFocusRipple:c,size:u}),m=lX(p);return R.jsx(cX,N({className:Se(m.root,s),centerRipple:!0,focusRipple:!c,disabled:l,ref:n},d,{ownerState:p,children:i}))}),dX=(e="default")=>e==="inherit"?"inherit":e==="default"?"action.active":qE.includes(e)?`${e}.${hr}`:`${e}.main`;var Yh=we.forwardRef((e,t)=>{const{sx:n={},color:r}=e,i={[e.href?jl:"&:hover,&:focus,&:active"]:{color:dX(r)}};return we.createElement(uX,{...e,sx:{...i,...n},ref:t})});function pX(e){return Ot("MuiButton",e)}const Jh=vt("MuiButton",["root","text","textInherit","textPrimary","textSecondary","textSuccess","textError","textInfo","textWarning","outlined","outlinedInherit","outlinedPrimary","outlinedSecondary","outlinedSuccess","outlinedError","outlinedInfo","outlinedWarning","contained","containedInherit","containedPrimary","containedSecondary","containedSuccess","containedError","containedInfo","containedWarning","disableElevation","focusVisible","disabled","colorInherit","colorPrimary","colorSecondary","colorSuccess","colorError","colorInfo","colorWarning","textSizeSmall","textSizeMedium","textSizeLarge","outlinedSizeSmall","outlinedSizeMedium","outlinedSizeLarge","containedSizeSmall","containedSizeMedium","containedSizeLarge","sizeMedium","sizeSmall","sizeLarge","fullWidth","startIcon","endIcon","icon","iconSizeSmall","iconSizeMedium","iconSizeLarge"]),KO=P.createContext({}),fX=P.createContext(void 0),mX=["children","color","component","className","disabled","disableElevation","disableFocusRipple","endIcon","focusVisibleClassName","fullWidth","size","startIcon","type","variant"],hX=e=>{const{color:t,disableElevation:n,fullWidth:r,size:o,variant:i,classes:s}=e,a={root:["root",i,`${i}${ae(t)}`,`size${ae(o)}`,`${i}Size${ae(o)}`,`color${ae(t)}`,n&&"disableElevation",r&&"fullWidth"],label:["label"],startIcon:["icon","startIcon",`iconSize${ae(o)}`],endIcon:["icon","endIcon",`iconSize${ae(o)}`]},l=$t(a,pX,s);return N({},s,l)},ZO=e=>N({},e.size==="small"&&{"& > *:nth-of-type(1)":{fontSize:18}},e.size==="medium"&&{"& > *:nth-of-type(1)":{fontSize:20}},e.size==="large"&&{"& > *:nth-of-type(1)":{fontSize:22}}),gX=Me(Ul,{shouldForwardProp:e=>kh(e)||e==="classes",name:"MuiButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`${n.variant}${ae(n.color)}`],t[`size${ae(n.size)}`],t[`${n.variant}Size${ae(n.size)}`],n.color==="inherit"&&t.colorInherit,n.disableElevation&&t.disableElevation,n.fullWidth&&t.fullWidth]}})(({theme:e,ownerState:t})=>{var n,r;const o=e.palette.mode==="light"?e.palette.grey[300]:e.palette.grey[800],i=e.palette.mode==="light"?e.palette.grey.A100:e.palette.grey[700];return N({},e.typography.button,{minWidth:64,padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create(["background-color","box-shadow","border-color","color"],{duration:e.transitions.duration.short}),"&:hover":N({textDecoration:"none",backgroundColor:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / ${e.vars.palette.action.hoverOpacity})`:wt(e.palette.text.primary,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="text"&&t.color!=="inherit"&&{backgroundColor:e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:wt(e.palette[t.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="outlined"&&t.color!=="inherit"&&{border:`1px solid ${(e.vars||e).palette[t.color].main}`,backgroundColor:e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:wt(e.palette[t.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},t.variant==="contained"&&{backgroundColor:e.vars?e.vars.palette.Button.inheritContainedHoverBg:i,boxShadow:(e.vars||e).shadows[4],"@media (hover: none)":{boxShadow:(e.vars||e).shadows[2],backgroundColor:(e.vars||e).palette.grey[300]}},t.variant==="contained"&&t.color!=="inherit"&&{backgroundColor:(e.vars||e).palette[t.color].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[t.color].main}}),"&:active":N({},t.variant==="contained"&&{boxShadow:(e.vars||e).shadows[8]}),[`&.${Jh.focusVisible}`]:N({},t.variant==="contained"&&{boxShadow:(e.vars||e).shadows[6]}),[`&.${Jh.disabled}`]:N({color:(e.vars||e).palette.action.disabled},t.variant==="outlined"&&{border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`},t.variant==="contained"&&{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground})},t.variant==="text"&&{padding:"6px 8px"},t.variant==="text"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].main},t.variant==="outlined"&&{padding:"5px 15px",border:"1px solid currentColor"},t.variant==="outlined"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].main,border:e.vars?`1px solid rgba(${e.vars.palette[t.color].mainChannel} / 0.5)`:`1px solid ${wt(e.palette[t.color].main,.5)}`},t.variant==="contained"&&{color:e.vars?e.vars.palette.text.primary:(n=(r=e.palette).getContrastText)==null?void 0:n.call(r,e.palette.grey[300]),backgroundColor:e.vars?e.vars.palette.Button.inheritContainedBg:o,boxShadow:(e.vars||e).shadows[2]},t.variant==="contained"&&t.color!=="inherit"&&{color:(e.vars||e).palette[t.color].contrastText,backgroundColor:(e.vars||e).palette[t.color].main},t.color==="inherit"&&{color:"inherit",borderColor:"currentColor"},t.size==="small"&&t.variant==="text"&&{padding:"4px 5px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="text"&&{padding:"8px 11px",fontSize:e.typography.pxToRem(15)},t.size==="small"&&t.variant==="outlined"&&{padding:"3px 9px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="outlined"&&{padding:"7px 21px",fontSize:e.typography.pxToRem(15)},t.size==="small"&&t.variant==="contained"&&{padding:"4px 10px",fontSize:e.typography.pxToRem(13)},t.size==="large"&&t.variant==="contained"&&{padding:"8px 22px",fontSize:e.typography.pxToRem(15)},t.fullWidth&&{width:"100%"})},({ownerState:e})=>e.disableElevation&&{boxShadow:"none","&:hover":{boxShadow:"none"},[`&.${Jh.focusVisible}`]:{boxShadow:"none"},"&:active":{boxShadow:"none"},[`&.${Jh.disabled}`]:{boxShadow:"none"}}),yX=Me("span",{name:"MuiButton",slot:"StartIcon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.startIcon,t[`iconSize${ae(n.size)}`]]}})(({ownerState:e})=>N({display:"inherit",marginRight:8,marginLeft:-4},e.size==="small"&&{marginLeft:-2},ZO(e))),wX=Me("span",{name:"MuiButton",slot:"EndIcon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.endIcon,t[`iconSize${ae(n.size)}`]]}})(({ownerState:e})=>N({display:"inherit",marginRight:-4,marginLeft:8},e.size==="small"&&{marginRight:-2},ZO(e))),vX=P.forwardRef(function(t,n){const r=P.useContext(KO),o=P.useContext(fX),i=rO(r,t),s=St({props:i,name:"MuiButton"}),{children:a,color:l="primary",component:c="button",className:u,disabled:d=!1,disableElevation:p=!1,disableFocusRipple:m=!1,endIcon:h,focusVisibleClassName:w,fullWidth:v=!1,size:f="medium",startIcon:g,type:y,variant:_="text"}=s,E=xe(s,mX),S=N({},s,{color:l,component:c,disabled:d,disableElevation:p,disableFocusRipple:m,fullWidth:v,size:f,type:y,variant:_}),k=hX(S),C=g&&R.jsx(yX,{className:k.startIcon,ownerState:S,children:g}),O=h&&R.jsx(wX,{className:k.endIcon,ownerState:S,children:h}),U=o||"";return R.jsxs(gX,N({ownerState:S,className:Se(r.className,k.root,u,U),component:c,disabled:d,focusRipple:!m,focusVisibleClassName:Se(k.focusVisible,w),ref:n,type:y},E,{classes:k,children:[C,a,O]}))});function _X(e){return Ot("MuiCircularProgress",e)}vt("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const bX=["className","color","disableShrink","size","style","thickness","value","variant"];let Xh=e=>e,YO,JO,XO,QO;const Yi=44,EX=Sl(YO||(YO=Xh` 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } `)),SX=Sl(JO||(JO=Xh` 0% { stroke-dasharray: 1px, 200px; stroke-dashoffset: 0; } 50% { stroke-dasharray: 100px, 200px; stroke-dashoffset: -15px; } 100% { stroke-dasharray: 100px, 200px; stroke-dashoffset: -125px; } `)),TX=e=>{const{classes:t,variant:n,color:r,disableShrink:o}=e,i={root:["root",n,`color${ae(r)}`],svg:["svg"],circle:["circle",`circle${ae(n)}`,o&&"circleDisableShrink"]};return $t(i,_X,t)},kX=Me("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`color${ae(n.color)}`]]}})(({ownerState:e,theme:t})=>N({display:"inline-block"},e.variant==="determinate"&&{transition:t.transitions.create("transform")},e.color!=="inherit"&&{color:(t.vars||t).palette[e.color].main}),({ownerState:e})=>e.variant==="indeterminate"&&lh(XO||(XO=Xh` animation: ${0} 1.4s linear infinite; `),EX)),xX=Me("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(e,t)=>t.svg})({display:"block"}),CX=Me("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.circle,t[`circle${ae(n.variant)}`],n.disableShrink&&t.circleDisableShrink]}})(({ownerState:e,theme:t})=>N({stroke:"currentColor"},e.variant==="determinate"&&{transition:t.transitions.create("stroke-dashoffset")},e.variant==="indeterminate"&&{strokeDasharray:"80px, 200px",strokeDashoffset:0}),({ownerState:e})=>e.variant==="indeterminate"&&!e.disableShrink&&lh(QO||(QO=Xh` animation: ${0} 1.4s ease-in-out infinite; `),SX)),IX=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiCircularProgress"}),{className:o,color:i="primary",disableShrink:s=!1,size:a=40,style:l,thickness:c=3.6,value:u=0,variant:d="indeterminate"}=r,p=xe(r,bX),m=N({},r,{color:i,disableShrink:s,size:a,thickness:c,value:u,variant:d}),h=TX(m),w={},v={},f={};if(d==="determinate"){const g=2*Math.PI*((Yi-c)/2);w.strokeDasharray=g.toFixed(3),f["aria-valuenow"]=Math.round(u),w.strokeDashoffset=`${((100-u)/100*g).toFixed(3)}px`,v.transform="rotate(-90deg)"}return R.jsx(kX,N({className:Se(h.root,o),style:N({width:a,height:a},v,l),ownerState:m,ref:n,role:"progressbar"},f,p,{children:R.jsx(xX,{className:h.svg,ownerState:m,viewBox:`${Yi/2} ${Yi/2} ${Yi} ${Yi}`,children:R.jsx(CX,{className:h.circle,style:w,ownerState:m,cx:Yi,cy:Yi,r:(Yi-c)/2,fill:"none",strokeWidth:c})})}))}),eN={color:"inherit",size:"1em"},tN=we.forwardRef((e,t)=>we.createElement(IX,{...eN,...e,ref:t}));tN.defaultProps=eN;var Qh=tN;const nN="rgba(0, 0, 0, 0.04)",rN="rgba(0, 0, 0, 0.08)",PX=125,RX=GE(vX)(({theme:e,ownerState:t})=>{var u,d,p;const{color:n,unstableToColor:r,unstableGradientAngle:o}=t,i=!n||n==="inherit"?"primary":n,s=!!((u=e.palette[i])!=null&&u.__unstableTonalMain),a=({variant:m})=>m==="unstableTonal"&&s,l=({variant:m})=>m==="unstableGradient"&&s,c=({variant:m})=>m?!["contained","outlined","text"].includes(m):!1;return{variants:[{props:()=>t.loading&&t.loadingPosition==="center",style:{"&.MuiButtonBase-root":{"&, &:hover, &:focus, &:active":{color:"transparent"}},"& .MuiButton-loadingWrapper":{display:"contents","& .MuiButton-loadingIndicator":{display:"flex",position:"absolute",left:"50%",transform:"translateX(-50%)",color:e.palette.action.disabled}}}},{props:m=>a(m)&&m.color!=="inherit"&&!m.disabled,style:{background:(d=e.palette[i])==null?void 0:d.__unstableTonalMain,color:e.palette[i].main,"&:hover":{backgroundColor:(p=e.palette[i])==null?void 0:p.__unstableTonalDark}}},{props:m=>m.disabled&&c(m),style:{background:e.palette.action.disabledBackground,color:e.palette.action.disabled}},{props:m=>a(m)&&m.color==="inherit",style:{background:nN,color:"inherit","&:hover":{backgroundColor:rN}}},{props:m=>m.variant==="unstableTonal"&&!s,style:{background:"#ff0000",color:"#ff0000"}},{props:m=>m.size==="small"&&c(m),style:{padding:"4px 10px",fontSize:e.typography.pxToRem(13)}},{props:m=>m.size==="large"&&c(m),style:{padding:"8px 22px",fontSize:e.typography.pxToRem(15)}},{props:m=>l(m)&&!m.disabled,style:NX(e,o,n,r)},{props:m=>m.variant==="unstableGradient"&&!s,style:{background:"#ff0000",color:"#ff0000"}}]}}),AX=(e="primary",t="text",n)=>{if(e)return e==="inherit"?"inherit":t==="contained"?`${e}.contrastText`:t==="unstableTonal"?`${e}.main`:n.palette.primary.__unstableAccessibleMain&&qE.includes(e)?`${e}.${hr}`:`${e}.main`},oN={loading:!1,loadingIndicator:we.createElement(Qh,{color:"inherit",size:16}),loadingPosition:"center"},iN=we.forwardRef((e,t)=>{const n={...oN,...e},r=we.useContext(KO),o=cd(),{sx:i={},unstableToColor:s,unstableGradientAngle:a,...l}=OX(n),c={...l,loading:n.loading,loadingPosition:n.loadingPosition,loadingIndicator:n.loadingIndicator,unstableToColor:s,unstableGradientAngle:a};let u={};const d=l.href?jl:"&:hover,&:focus,&:active",p=l.color||(r==null?void 0:r.color),m=l.variant||(r==null?void 0:r.variant);return u={[d]:{color:AX(p,m,o)}},we.createElement(RX,{...l,color:p,variant:m,sx:{...u,...i},ref:t,ownerState:c})});var qs=iN;iN.defaultProps=oN;function $X({loadingIndicator:e,children:t}){return we.createElement(we.Fragment,null,we.createElement("div",{className:"MuiButton-loadingWrapper"},we.createElement("div",{className:"MuiButton-loadingIndicator"},e)),t)}function OX(e){const{loading:t,loadingPosition:n,loadingIndicator:r,...o}=e;if(!t)return o;switch(n){case"start":o.startIcon=r;break;case"end":o.endIcon=r;break;case"center":o.children=we.createElement($X,{loadingIndicator:r},e.children);break}return{...o,disabled:!0}}function NX(e,t,n,r){if(!n)return;const o=n,i=LX(e,t);let{main:s,__unstableTonalMain:a,__unstableTonalDark:l}=e.palette[o]||{};n==="inherit"&&(s="inherit",a=nN,l=rN);const c=[a],u=[l];if(r){const d=r,{__unstableTonalMain:p,__unstableTonalDark:m}=e.palette[d];c.push(p),u.push(m)}return{color:s,backgroundImage:`linear-gradient( ${i}deg, ${c.join(", ")} )`,"&:hover":{backgroundImage:`linear-gradient( ${i}deg, ${u.join(",")} )`}}}function LX(e,t){if(t!==void 0)return t;const{__unstableGradientAngle:n}=e.palette.action;return n!==void 0?n:PX}const sN="base";function MX(e){return`${sN}--${e}`}function DX(e,t){return`${sN}-${e}-${t}`}function UX(e,t){const n=g1[t];return n?MX(n):DX(e,t)}const jX=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])'].join(",");function WX(e){const t=parseInt(e.getAttribute("tabindex")||"",10);return Number.isNaN(t)?e.contentEditable==="true"||(e.nodeName==="AUDIO"||e.nodeName==="VIDEO"||e.nodeName==="DETAILS")&&e.getAttribute("tabindex")===null?0:e.tabIndex:t}function FX(e){if(e.tagName!=="INPUT"||e.type!=="radio"||!e.name)return!1;const t=r=>e.ownerDocument.querySelector(`input[type="radio"]${r}`);let n=t(`[name="${e.name}"]:checked`);return n||(n=t(`[name="${e.name}"]`)),n!==e}function zX(e){return!(e.disabled||e.tagName==="INPUT"&&e.type==="hidden"||FX(e))}function BX(e){const t=[],n=[];return Array.from(e.querySelectorAll(jX)).forEach((r,o)=>{const i=WX(r);i===-1||!zX(r)||(i===0?t.push(r):n.push({documentOrder:o,tabIndex:i,node:r}))}),n.sort((r,o)=>r.tabIndex===o.tabIndex?r.documentOrder-o.documentOrder:r.tabIndex-o.tabIndex).map(r=>r.node).concat(t)}function GX(){return!0}function HX(e){const{children:t,disableAutoFocus:n=!1,disableEnforceFocus:r=!1,disableRestoreFocus:o=!1,getTabbable:i=BX,isEnabled:s=GX,open:a}=e,l=P.useRef(!1),c=P.useRef(null),u=P.useRef(null),d=P.useRef(null),p=P.useRef(null),m=P.useRef(!1),h=P.useRef(null),w=Lr(t.ref,h),v=P.useRef(null);P.useEffect(()=>{!a||!h.current||(m.current=!n)},[n,a]),P.useEffect(()=>{if(!a||!h.current)return;const y=Io(h.current);return h.current.contains(y.activeElement)||(h.current.hasAttribute("tabIndex")||h.current.setAttribute("tabIndex","-1"),m.current&&h.current.focus()),()=>{o||(d.current&&d.current.focus&&(l.current=!0,d.current.focus()),d.current=null)}},[a]),P.useEffect(()=>{if(!a||!h.current)return;const y=Io(h.current),_=k=>{v.current=k,!(r||!s()||k.key!=="Tab")&&y.activeElement===h.current&&k.shiftKey&&(l.current=!0,u.current&&u.current.focus())},E=()=>{const k=h.current;if(k===null)return;if(!y.hasFocus()||!s()||l.current){l.current=!1;return}if(k.contains(y.activeElement)||r&&y.activeElement!==c.current&&y.activeElement!==u.current)return;if(y.activeElement!==p.current)p.current=null;else if(p.current!==null)return;if(!m.current)return;let C=[];if((y.activeElement===c.current||y.activeElement===u.current)&&(C=i(h.current)),C.length>0){var O,U;const T=!!((O=v.current)!=null&&O.shiftKey&&((U=v.current)==null?void 0:U.key)==="Tab"),A=C[0],L=C[C.length-1];typeof A!="string"&&typeof L!="string"&&(T?L.focus():A.focus())}else k.focus()};y.addEventListener("focusin",E),y.addEventListener("keydown",_,!0);const S=setInterval(()=>{y.activeElement&&y.activeElement.tagName==="BODY"&&E()},50);return()=>{clearInterval(S),y.removeEventListener("focusin",E),y.removeEventListener("keydown",_,!0)}},[n,r,o,s,a,i]);const f=y=>{d.current===null&&(d.current=y.relatedTarget),m.current=!0,p.current=y.target;const _=t.props.onFocus;_&&_(y)},g=y=>{d.current===null&&(d.current=y.relatedTarget),m.current=!0};return R.jsxs(P.Fragment,{children:[R.jsx("div",{tabIndex:a?0:-1,onFocus:g,ref:c,"data-testid":"sentinelStart"}),P.cloneElement(t,{ref:w,onFocus:f}),R.jsx("div",{tabIndex:a?0:-1,onFocus:g,ref:u,"data-testid":"sentinelEnd"})]})}function qX(e){return typeof e=="function"?e():e}const aN=P.forwardRef(function(t,n){const{children:r,container:o,disablePortal:i=!1}=t,[s,a]=P.useState(null),l=Lr(P.isValidElement(r)?r.ref:null,n);if(Ml(()=>{i||a(qX(o)||document.body)},[o,i]),Ml(()=>{if(s&&!i)return ME(n,s),()=>{ME(n,null)}},[n,s,i]),i){if(P.isValidElement(r)){const c={ref:l};return P.cloneElement(r,c)}return R.jsx(P.Fragment,{children:r})}return R.jsx(P.Fragment,{children:s&&Gb.createPortal(r,s)})});function VX(e){const t=Io(e);return t.body===e?LE(e).innerWidth>t.documentElement.clientWidth:e.scrollHeight>e.clientHeight}function gd(e,t){t?e.setAttribute("aria-hidden","true"):e.removeAttribute("aria-hidden")}function lN(e){return parseInt(LE(e).getComputedStyle(e).paddingRight,10)||0}function KX(e){const n=["TEMPLATE","SCRIPT","STYLE","LINK","MAP","META","NOSCRIPT","PICTURE","COL","COLGROUP","PARAM","SLOT","SOURCE","TRACK"].indexOf(e.tagName)!==-1,r=e.tagName==="INPUT"&&e.getAttribute("type")==="hidden";return n||r}function cN(e,t,n,r,o){const i=[t,n,...r];[].forEach.call(e.children,s=>{const a=i.indexOf(s)===-1,l=!KX(s);a&&l&&gd(s,o)})}function YE(e,t){let n=-1;return e.some((r,o)=>t(r)?(n=o,!0):!1),n}function ZX(e,t){const n=[],r=e.container;if(!t.disableScrollLock){if(VX(r)){const s=YZ(Io(r));n.push({value:r.style.paddingRight,property:"padding-right",el:r}),r.style.paddingRight=`${lN(r)+s}px`;const a=Io(r).querySelectorAll(".mui-fixed");[].forEach.call(a,l=>{n.push({value:l.style.paddingRight,property:"padding-right",el:l}),l.style.paddingRight=`${lN(l)+s}px`})}let i;if(r.parentNode instanceof DocumentFragment)i=Io(r).body;else{const s=r.parentElement,a=LE(r);i=(s==null?void 0:s.nodeName)==="HTML"&&a.getComputedStyle(s).overflowY==="scroll"?s:r}n.push({value:i.style.overflow,property:"overflow",el:i},{value:i.style.overflowX,property:"overflow-x",el:i},{value:i.style.overflowY,property:"overflow-y",el:i}),i.style.overflow="hidden"}return()=>{n.forEach(({value:i,el:s,property:a})=>{i?s.style.setProperty(a,i):s.style.removeProperty(a)})}}function YX(e){const t=[];return[].forEach.call(e.children,n=>{n.getAttribute("aria-hidden")==="true"&&t.push(n)}),t}class JX{constructor(){this.containers=void 0,this.modals=void 0,this.modals=[],this.containers=[]}add(t,n){let r=this.modals.indexOf(t);if(r!==-1)return r;r=this.modals.length,this.modals.push(t),t.modalRef&&gd(t.modalRef,!1);const o=YX(n);cN(n,t.mount,t.modalRef,o,!0);const i=YE(this.containers,s=>s.container===n);return i!==-1?(this.containers[i].modals.push(t),r):(this.containers.push({modals:[t],container:n,restore:null,hiddenSiblings:o}),r)}mount(t,n){const r=YE(this.containers,i=>i.modals.indexOf(t)!==-1),o=this.containers[r];o.restore||(o.restore=ZX(o,n))}remove(t,n=!0){const r=this.modals.indexOf(t);if(r===-1)return r;const o=YE(this.containers,s=>s.modals.indexOf(t)!==-1),i=this.containers[o];if(i.modals.splice(i.modals.indexOf(t),1),this.modals.splice(r,1),i.modals.length===0)i.restore&&i.restore(),t.modalRef&&gd(t.modalRef,n),cN(i.container,t.mount,t.modalRef,i.hiddenSiblings,!1),this.containers.splice(o,1);else{const s=i.modals[i.modals.length-1];s.modalRef&&gd(s.modalRef,!1)}return r}isTopModal(t){return this.modals.length>0&&this.modals[this.modals.length-1]===t}}function XX(e){return typeof e=="function"?e():e}function QX(e){return e?e.props.hasOwnProperty("in"):!1}const eQ=new JX;function tQ(e){const{container:t,disableEscapeKeyDown:n=!1,disableScrollLock:r=!1,manager:o=eQ,closeAfterTransition:i=!1,onTransitionEnter:s,onTransitionExited:a,children:l,onClose:c,open:u,rootRef:d}=e,p=P.useRef({}),m=P.useRef(null),h=P.useRef(null),w=Lr(h,d),[v,f]=P.useState(!u),g=QX(l);let y=!0;(e["aria-hidden"]==="false"||e["aria-hidden"]===!1)&&(y=!1);const _=()=>Io(m.current),E=()=>(p.current.modalRef=h.current,p.current.mount=m.current,p.current),S=()=>{o.mount(E(),{disableScrollLock:r}),h.current&&(h.current.scrollTop=0)},k=Dl(()=>{const K=XX(t)||_().body;o.add(E(),K),h.current&&S()}),C=P.useCallback(()=>o.isTopModal(E()),[o]),O=Dl(K=>{m.current=K,K&&(u&&C()?S():h.current&&gd(h.current,y))}),U=P.useCallback(()=>{o.remove(E(),y)},[y,o]);P.useEffect(()=>()=>{U()},[U]),P.useEffect(()=>{u?k():(!g||!i)&&U()},[u,U,g,i,k]);const T=K=>J=>{var z;(z=K.onKeyDown)==null||z.call(K,J),!(J.key!=="Escape"||J.which===229||!C())&&(n||(J.stopPropagation(),c&&c(J,"escapeKeyDown")))},A=K=>J=>{var z;(z=K.onClick)==null||z.call(K,J),J.target===J.currentTarget&&c&&c(J,"backdropClick")};return{getRootProps:(K={})=>{const J=sO(e);delete J.onTransitionEnter,delete J.onTransitionExited;const z=N({},J,K);return N({role:"presentation"},z,{onKeyDown:T(z),ref:w})},getBackdropProps:(K={})=>{const J=K;return N({"aria-hidden":!0},J,{onClick:A(J),open:u})},getTransitionProps:()=>{const K=()=>{f(!1),s&&s()},J=()=>{f(!0),a&&a(),i&&U()};return{onEnter:Q1(K,l==null?void 0:l.props.onEnter),onExited:Q1(J,l==null?void 0:l.props.onExited)}},rootRef:w,portalRef:O,isTopModal:C,exited:v,hasTransition:g}}var Yn="top",Dr="bottom",Ur="right",Jn="left",JE="auto",yd=[Yn,Dr,Ur,Jn],Bl="start",wd="end",nQ="clippingParents",uN="viewport",vd="popper",rQ="reference",dN=yd.reduce(function(e,t){return e.concat([t+"-"+Bl,t+"-"+wd])},[]),pN=[].concat(yd,[JE]).reduce(function(e,t){return e.concat([t,t+"-"+Bl,t+"-"+wd])},[]),oQ="beforeRead",iQ="read",sQ="afterRead",aQ="beforeMain",lQ="main",cQ="afterMain",uQ="beforeWrite",dQ="write",pQ="afterWrite",fQ=[oQ,iQ,sQ,aQ,lQ,cQ,uQ,dQ,pQ];function Po(e){return e?(e.nodeName||"").toLowerCase():null}function gr(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Vs(e){var t=gr(e).Element;return e instanceof t||e instanceof Element}function jr(e){var t=gr(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function XE(e){if(typeof ShadowRoot>"u")return!1;var t=gr(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function mQ(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},i=t.elements[n];!jr(i)||!Po(i)||(Object.assign(i.style,r),Object.keys(o).forEach(function(s){var a=o[s];a===!1?i.removeAttribute(s):i.setAttribute(s,a===!0?"":a)}))})}function hQ(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],i=t.attributes[r]||{},s=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),a=s.reduce(function(l,c){return l[c]="",l},{});!jr(o)||!Po(o)||(Object.assign(o.style,a),Object.keys(i).forEach(function(l){o.removeAttribute(l)}))})}}const gQ={name:"applyStyles",enabled:!0,phase:"write",fn:mQ,effect:hQ,requires:["computeStyles"]};function Ro(e){return e.split("-")[0]}var Ks=Math.max,eg=Math.min,Gl=Math.round;function QE(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function fN(){return!/^((?!chrome|android).)*safari/i.test(QE())}function Hl(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,i=1;t&&jr(e)&&(o=e.offsetWidth>0&&Gl(r.width)/e.offsetWidth||1,i=e.offsetHeight>0&&Gl(r.height)/e.offsetHeight||1);var s=Vs(e)?gr(e):window,a=s.visualViewport,l=!fN()&&n,c=(r.left+(l&&a?a.offsetLeft:0))/o,u=(r.top+(l&&a?a.offsetTop:0))/i,d=r.width/o,p=r.height/i;return{width:d,height:p,top:u,right:c+d,bottom:u+p,left:c,x:c,y:u}}function eS(e){var t=Hl(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function mN(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&XE(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function li(e){return gr(e).getComputedStyle(e)}function yQ(e){return["table","td","th"].indexOf(Po(e))>=0}function Ji(e){return((Vs(e)?e.ownerDocument:e.document)||window.document).documentElement}function tg(e){return Po(e)==="html"?e:e.assignedSlot||e.parentNode||(XE(e)?e.host:null)||Ji(e)}function hN(e){return!jr(e)||li(e).position==="fixed"?null:e.offsetParent}function wQ(e){var t=/firefox/i.test(QE()),n=/Trident/i.test(QE());if(n&&jr(e)){var r=li(e);if(r.position==="fixed")return null}var o=tg(e);for(XE(o)&&(o=o.host);jr(o)&&["html","body"].indexOf(Po(o))<0;){var i=li(o);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||t&&i.willChange==="filter"||t&&i.filter&&i.filter!=="none")return o;o=o.parentNode}return null}function _d(e){for(var t=gr(e),n=hN(e);n&&yQ(n)&&li(n).position==="static";)n=hN(n);return n&&(Po(n)==="html"||Po(n)==="body"&&li(n).position==="static")?t:n||wQ(e)||t}function tS(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function bd(e,t,n){return Ks(e,eg(t,n))}function vQ(e,t,n){var r=bd(e,t,n);return r>n?n:r}function gN(){return{top:0,right:0,bottom:0,left:0}}function yN(e){return Object.assign({},gN(),e)}function wN(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var _Q=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,yN(typeof t!="number"?t:wN(t,yd))};function bQ(e){var t,n=e.state,r=e.name,o=e.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,a=Ro(n.placement),l=tS(a),c=[Jn,Ur].indexOf(a)>=0,u=c?"height":"width";if(!(!i||!s)){var d=_Q(o.padding,n),p=eS(i),m=l==="y"?Yn:Jn,h=l==="y"?Dr:Ur,w=n.rects.reference[u]+n.rects.reference[l]-s[l]-n.rects.popper[u],v=s[l]-n.rects.reference[l],f=_d(i),g=f?l==="y"?f.clientHeight||0:f.clientWidth||0:0,y=w/2-v/2,_=d[m],E=g-p[u]-d[h],S=g/2-p[u]/2+y,k=bd(_,S,E),C=l;n.modifiersData[r]=(t={},t[C]=k,t.centerOffset=k-S,t)}}function EQ(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||mN(t.elements.popper,o)&&(t.elements.arrow=o))}const SQ={name:"arrow",enabled:!0,phase:"main",fn:bQ,effect:EQ,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ql(e){return e.split("-")[1]}var TQ={top:"auto",right:"auto",bottom:"auto",left:"auto"};function kQ(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:Gl(n*o)/o||0,y:Gl(r*o)/o||0}}function vN(e){var t,n=e.popper,r=e.popperRect,o=e.placement,i=e.variation,s=e.offsets,a=e.position,l=e.gpuAcceleration,c=e.adaptive,u=e.roundOffsets,d=e.isFixed,p=s.x,m=p===void 0?0:p,h=s.y,w=h===void 0?0:h,v=typeof u=="function"?u({x:m,y:w}):{x:m,y:w};m=v.x,w=v.y;var f=s.hasOwnProperty("x"),g=s.hasOwnProperty("y"),y=Jn,_=Yn,E=window;if(c){var S=_d(n),k="clientHeight",C="clientWidth";if(S===gr(n)&&(S=Ji(n),li(S).position!=="static"&&a==="absolute"&&(k="scrollHeight",C="scrollWidth")),S=S,o===Yn||(o===Jn||o===Ur)&&i===wd){_=Dr;var O=d&&S===E&&E.visualViewport?E.visualViewport.height:S[k];w-=O-r.height,w*=l?1:-1}if(o===Jn||(o===Yn||o===Dr)&&i===wd){y=Ur;var U=d&&S===E&&E.visualViewport?E.visualViewport.width:S[C];m-=U-r.width,m*=l?1:-1}}var T=Object.assign({position:a},c&&TQ),A=u===!0?kQ({x:m,y:w},gr(n)):{x:m,y:w};if(m=A.x,w=A.y,l){var L;return Object.assign({},T,(L={},L[_]=g?"0":"",L[y]=f?"0":"",L.transform=(E.devicePixelRatio||1)<=1?"translate("+m+"px, "+w+"px)":"translate3d("+m+"px, "+w+"px, 0)",L))}return Object.assign({},T,(t={},t[_]=g?w+"px":"",t[y]=f?m+"px":"",t.transform="",t))}function xQ(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,i=n.adaptive,s=i===void 0?!0:i,a=n.roundOffsets,l=a===void 0?!0:a,c={placement:Ro(t.placement),variation:ql(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,vN(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,vN(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const CQ={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:xQ,data:{}};var ng={passive:!0};function IQ(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,i=o===void 0?!0:o,s=r.resize,a=s===void 0?!0:s,l=gr(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&c.forEach(function(u){u.addEventListener("scroll",n.update,ng)}),a&&l.addEventListener("resize",n.update,ng),function(){i&&c.forEach(function(u){u.removeEventListener("scroll",n.update,ng)}),a&&l.removeEventListener("resize",n.update,ng)}}const PQ={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:IQ,data:{}};var RQ={left:"right",right:"left",bottom:"top",top:"bottom"};function rg(e){return e.replace(/left|right|bottom|top/g,function(t){return RQ[t]})}var AQ={start:"end",end:"start"};function _N(e){return e.replace(/start|end/g,function(t){return AQ[t]})}function nS(e){var t=gr(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function rS(e){return Hl(Ji(e)).left+nS(e).scrollLeft}function $Q(e,t){var n=gr(e),r=Ji(e),o=n.visualViewport,i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;var c=fN();(c||!c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a+rS(e),y:l}}function OQ(e){var t,n=Ji(e),r=nS(e),o=(t=e.ownerDocument)==null?void 0:t.body,i=Ks(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=Ks(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+rS(e),l=-r.scrollTop;return li(o||n).direction==="rtl"&&(a+=Ks(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:a,y:l}}function oS(e){var t=li(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function bN(e){return["html","body","#document"].indexOf(Po(e))>=0?e.ownerDocument.body:jr(e)&&oS(e)?e:bN(tg(e))}function Ed(e,t){var n;t===void 0&&(t=[]);var r=bN(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),i=gr(r),s=o?[i].concat(i.visualViewport||[],oS(r)?r:[]):r,a=t.concat(s);return o?a:a.concat(Ed(tg(s)))}function iS(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function NQ(e,t){var n=Hl(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function EN(e,t,n){return t===uN?iS($Q(e,n)):Vs(t)?NQ(t,n):iS(OQ(Ji(e)))}function LQ(e){var t=Ed(tg(e)),n=["absolute","fixed"].indexOf(li(e).position)>=0,r=n&&jr(e)?_d(e):e;return Vs(r)?t.filter(function(o){return Vs(o)&&mN(o,r)&&Po(o)!=="body"}):[]}function MQ(e,t,n,r){var o=t==="clippingParents"?LQ(e):[].concat(t),i=[].concat(o,[n]),s=i[0],a=i.reduce(function(l,c){var u=EN(e,c,r);return l.top=Ks(u.top,l.top),l.right=eg(u.right,l.right),l.bottom=eg(u.bottom,l.bottom),l.left=Ks(u.left,l.left),l},EN(e,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function SN(e){var t=e.reference,n=e.element,r=e.placement,o=r?Ro(r):null,i=r?ql(r):null,s=t.x+t.width/2-n.width/2,a=t.y+t.height/2-n.height/2,l;switch(o){case Yn:l={x:s,y:t.y-n.height};break;case Dr:l={x:s,y:t.y+t.height};break;case Ur:l={x:t.x+t.width,y:a};break;case Jn:l={x:t.x-n.width,y:a};break;default:l={x:t.x,y:t.y}}var c=o?tS(o):null;if(c!=null){var u=c==="y"?"height":"width";switch(i){case Bl:l[c]=l[c]-(t[u]/2-n[u]/2);break;case wd:l[c]=l[c]+(t[u]/2-n[u]/2);break}}return l}function Sd(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,i=n.strategy,s=i===void 0?e.strategy:i,a=n.boundary,l=a===void 0?nQ:a,c=n.rootBoundary,u=c===void 0?uN:c,d=n.elementContext,p=d===void 0?vd:d,m=n.altBoundary,h=m===void 0?!1:m,w=n.padding,v=w===void 0?0:w,f=yN(typeof v!="number"?v:wN(v,yd)),g=p===vd?rQ:vd,y=e.rects.popper,_=e.elements[h?g:p],E=MQ(Vs(_)?_:_.contextElement||Ji(e.elements.popper),l,u,s),S=Hl(e.elements.reference),k=SN({reference:S,element:y,placement:o}),C=iS(Object.assign({},y,k)),O=p===vd?C:S,U={top:E.top-O.top+f.top,bottom:O.bottom-E.bottom+f.bottom,left:E.left-O.left+f.left,right:O.right-E.right+f.right},T=e.modifiersData.offset;if(p===vd&&T){var A=T[o];Object.keys(U).forEach(function(L){var j=[Ur,Dr].indexOf(L)>=0?1:-1,q=[Yn,Dr].indexOf(L)>=0?"y":"x";U[L]+=A[q]*j})}return U}function DQ(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=l===void 0?pN:l,u=ql(r),d=u?a?dN:dN.filter(function(h){return ql(h)===u}):yd,p=d.filter(function(h){return c.indexOf(h)>=0});p.length===0&&(p=d);var m=p.reduce(function(h,w){return h[w]=Sd(e,{placement:w,boundary:o,rootBoundary:i,padding:s})[Ro(w)],h},{});return Object.keys(m).sort(function(h,w){return m[h]-m[w]})}function UQ(e){if(Ro(e)===JE)return[];var t=rg(e);return[_N(e),t,_N(t)]}function jQ(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,i=o===void 0?!0:o,s=n.altAxis,a=s===void 0?!0:s,l=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,p=n.altBoundary,m=n.flipVariations,h=m===void 0?!0:m,w=n.allowedAutoPlacements,v=t.options.placement,f=Ro(v),g=f===v,y=l||(g||!h?[rg(v)]:UQ(v)),_=[v].concat(y).reduce(function(x,I){return x.concat(Ro(I)===JE?DQ(t,{placement:I,boundary:u,rootBoundary:d,padding:c,flipVariations:h,allowedAutoPlacements:w}):I)},[]),E=t.rects.reference,S=t.rects.popper,k=new Map,C=!0,O=_[0],U=0;U<_.length;U++){var T=_[U],A=Ro(T),L=ql(T)===Bl,j=[Yn,Dr].indexOf(A)>=0,q=j?"width":"height",K=Sd(t,{placement:T,boundary:u,rootBoundary:d,altBoundary:p,padding:c}),J=j?L?Ur:Jn:L?Dr:Yn;E[q]>S[q]&&(J=rg(J));var z=rg(J),Z=[];if(i&&Z.push(K[A]<=0),a&&Z.push(K[J]<=0,K[z]<=0),Z.every(function(x){return x})){O=T,C=!1;break}k.set(T,Z)}if(C)for(var W=h?3:1,$=function(I){var F=_.find(function(ne){var re=k.get(ne);if(re)return re.slice(0,I).every(function(be){return be})});if(F)return O=F,"break"},G=W;G>0;G--){var D=$(G);if(D==="break")break}t.placement!==O&&(t.modifiersData[r]._skip=!0,t.placement=O,t.reset=!0)}}const WQ={name:"flip",enabled:!0,phase:"main",fn:jQ,requiresIfExists:["offset"],data:{_skip:!1}};function TN(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function kN(e){return[Yn,Ur,Dr,Jn].some(function(t){return e[t]>=0})}function FQ(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,s=Sd(t,{elementContext:"reference"}),a=Sd(t,{altBoundary:!0}),l=TN(s,r),c=TN(a,o,i),u=kN(l),d=kN(c);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}const zQ={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:FQ};function BQ(e,t,n){var r=Ro(e),o=[Jn,Yn].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,s=i[0],a=i[1];return s=s||0,a=(a||0)*o,[Jn,Ur].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function GQ(e){var t=e.state,n=e.options,r=e.name,o=n.offset,i=o===void 0?[0,0]:o,s=pN.reduce(function(u,d){return u[d]=BQ(d,t.rects,i),u},{}),a=s[t.placement],l=a.x,c=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=s}const HQ={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:GQ};function qQ(e){var t=e.state,n=e.name;t.modifiersData[n]=SN({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const VQ={name:"popperOffsets",enabled:!0,phase:"read",fn:qQ,data:{}};function KQ(e){return e==="x"?"y":"x"}function ZQ(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,i=o===void 0?!0:o,s=n.altAxis,a=s===void 0?!1:s,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,d=n.padding,p=n.tether,m=p===void 0?!0:p,h=n.tetherOffset,w=h===void 0?0:h,v=Sd(t,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),f=Ro(t.placement),g=ql(t.placement),y=!g,_=tS(f),E=KQ(_),S=t.modifiersData.popperOffsets,k=t.rects.reference,C=t.rects.popper,O=typeof w=="function"?w(Object.assign({},t.rects,{placement:t.placement})):w,U=typeof O=="number"?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),T=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,A={x:0,y:0};if(S){if(i){var L,j=_==="y"?Yn:Jn,q=_==="y"?Dr:Ur,K=_==="y"?"height":"width",J=S[_],z=J+v[j],Z=J-v[q],W=m?-C[K]/2:0,$=g===Bl?k[K]:C[K],G=g===Bl?-C[K]:-k[K],D=t.elements.arrow,x=m&&D?eS(D):{width:0,height:0},I=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:gN(),F=I[j],ne=I[q],re=bd(0,k[K],x[K]),be=y?k[K]/2-W-re-F-U.mainAxis:$-re-F-U.mainAxis,$e=y?-k[K]/2+W+re+ne+U.mainAxis:G+re+ne+U.mainAxis,it=t.elements.arrow&&_d(t.elements.arrow),er=it?_==="y"?it.clientTop||0:it.clientLeft||0:0,gn=(L=T==null?void 0:T[_])!=null?L:0,yr=J+be-gn-er,ta=J+$e-gn,os=bd(m?eg(z,yr):z,J,m?Ks(Z,ta):Z);S[_]=os,A[_]=os-J}if(a){var is,na=_==="x"?Yn:Jn,ra=_==="x"?Dr:Ur,Mn=S[E],zr=E==="y"?"height":"width",ss=Mn+v[na],as=Mn-v[ra],Br=[Yn,Jn].indexOf(f)!==-1,Gr=(is=T==null?void 0:T[E])!=null?is:0,No=Br?ss:Mn-k[zr]-C[zr]-Gr+U.altAxis,di=Br?Mn+k[zr]+C[zr]-Gr-U.altAxis:as,oa=m&&Br?vQ(No,Mn,di):bd(m?No:ss,Mn,m?di:as);S[E]=oa,A[E]=oa-Mn}t.modifiersData[r]=A}}const YQ={name:"preventOverflow",enabled:!0,phase:"main",fn:ZQ,requiresIfExists:["offset"]};function JQ(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function XQ(e){return e===gr(e)||!jr(e)?nS(e):JQ(e)}function QQ(e){var t=e.getBoundingClientRect(),n=Gl(t.width)/e.offsetWidth||1,r=Gl(t.height)/e.offsetHeight||1;return n!==1||r!==1}function eee(e,t,n){n===void 0&&(n=!1);var r=jr(t),o=jr(t)&&QQ(t),i=Ji(t),s=Hl(e,o,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Po(t)!=="body"||oS(i))&&(a=XQ(t)),jr(t)?(l=Hl(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):i&&(l.x=rS(i))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function tee(e){var t=new Map,n=new Set,r=[];e.forEach(function(i){t.set(i.name,i)});function o(i){n.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(a){if(!n.has(a)){var l=t.get(a);l&&o(l)}}),r.push(i)}return e.forEach(function(i){n.has(i.name)||o(i)}),r}function nee(e){var t=tee(e);return fQ.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function ree(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function oee(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var xN={placement:"bottom",modifiers:[],strategy:"absolute"};function CN(){for(var e=arguments.length,t=new Array(e),n=0;n$t({root:["root"]},lY(cee)),hee={},gee=P.forwardRef(function(t,n){var r;const{anchorEl:o,children:i,direction:s,disablePortal:a,modifiers:l,open:c,placement:u,popperOptions:d,popperRef:p,slotProps:m={},slots:h={},TransitionProps:w}=t,v=xe(t,uee),f=P.useRef(null),g=Lr(f,n),y=P.useRef(null),_=Lr(y,p),E=P.useRef(_);Ml(()=>{E.current=_},[_]),P.useImperativeHandle(p,()=>y.current,[]);const S=pee(u,s),[k,C]=P.useState(S),[O,U]=P.useState(sS(o));P.useEffect(()=>{y.current&&y.current.forceUpdate()}),P.useEffect(()=>{o&&U(sS(o))},[o]),Ml(()=>{if(!O||!c)return;const q=z=>{C(z.placement)};let K=[{name:"preventOverflow",options:{altBoundary:a}},{name:"flip",options:{altBoundary:a}},{name:"onUpdate",enabled:!0,phase:"afterWrite",fn:({state:z})=>{q(z)}}];l!=null&&(K=K.concat(l)),d&&d.modifiers!=null&&(K=K.concat(d.modifiers));const J=aee(O,f.current,N({placement:S},d,{modifiers:K}));return E.current(J),()=>{J.destroy(),E.current(null)}},[O,a,l,c,d,S]);const T={placement:k};w!==null&&(T.TransitionProps=w);const A=mee(),L=(r=h.root)!=null?r:"div",j=WE({elementType:L,externalSlotProps:m.root,externalForwardedProps:v,additionalProps:{role:"tooltip",ref:g},ownerState:t,className:A.root});return R.jsx(L,N({},j,{children:typeof i=="function"?i(T):i}))}),yee=P.forwardRef(function(t,n){const{anchorEl:r,children:o,container:i,direction:s="ltr",disablePortal:a=!1,keepMounted:l=!1,modifiers:c,open:u,placement:d="bottom",popperOptions:p=hee,popperRef:m,style:h,transition:w=!1,slotProps:v={},slots:f={}}=t,g=xe(t,dee),[y,_]=P.useState(!0),E=()=>{_(!1)},S=()=>{_(!0)};if(!l&&!u&&(!w||y))return null;let k;if(i)k=i;else if(r){const U=sS(r);k=U&&fee(U)?Io(U).body:Io(null).body}const C=!u&&l&&(!w||y)?"none":void 0,O=w?{in:u,onEnter:E,onExited:S}:void 0;return R.jsx(aN,{disablePortal:a,container:k,children:R.jsx(gee,N({anchorEl:r,direction:s,disablePortal:a,modifiers:c,ref:n,open:w?!y:u,placement:d,popperOptions:p,popperRef:m,slotProps:v,slots:f},g,{style:N({position:"fixed",top:0,left:0,display:C},h),TransitionProps:O,children:o}))})});var aS={};Object.defineProperty(aS,"__esModule",{value:!0});var IN=aS.default=void 0,wee=_ee(P),vee=N1;function PN(e){if(typeof WeakMap!="function")return null;var t=new WeakMap,n=new WeakMap;return(PN=function(r){return r?n:t})(e)}function _ee(e,t){if(e&&e.__esModule)return e;if(e===null||typeof e!="object"&&typeof e!="function")return{default:e};var n=PN(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(r,i,s):r[i]=e[i]}return r.default=e,n&&n.set(e,r),r}function bee(e){return Object.keys(e).length===0}function Eee(e=null){const t=wee.useContext(vee.ThemeContext);return!t||bee(t)?e:t}IN=aS.default=Eee;const See=["anchorEl","component","components","componentsProps","container","disablePortal","keepMounted","modifiers","open","placement","popperOptions","popperRef","transition","slots","slotProps"],Tee=Me(yee,{name:"MuiPopper",slot:"Root",overridesResolver:(e,t)=>t.root})({}),kee=P.forwardRef(function(t,n){var r;const o=IN(),i=St({props:t,name:"MuiPopper"}),{anchorEl:s,component:a,components:l,componentsProps:c,container:u,disablePortal:d,keepMounted:p,modifiers:m,open:h,placement:w,popperOptions:v,popperRef:f,transition:g,slots:y,slotProps:_}=i,E=xe(i,See),S=(r=y==null?void 0:y.root)!=null?r:l==null?void 0:l.Root,k=N({anchorEl:s,container:u,disablePortal:d,keepMounted:p,modifiers:m,open:h,placement:w,popperOptions:v,popperRef:f,transition:g},E);return R.jsx(Tee,N({as:a,direction:o==null?void 0:o.direction,slots:{root:S},slotProps:_??c},k,{ref:n}))}),xee=Oh(R.jsx("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}),"Cancel");function Cee(e){return Ot("MuiChip",e)}const Ke=vt("MuiChip",["root","sizeSmall","sizeMedium","colorError","colorInfo","colorPrimary","colorSecondary","colorSuccess","colorWarning","disabled","clickable","clickableColorPrimary","clickableColorSecondary","deletable","deletableColorPrimary","deletableColorSecondary","outlined","filled","outlinedPrimary","outlinedSecondary","filledPrimary","filledSecondary","avatar","avatarSmall","avatarMedium","avatarColorPrimary","avatarColorSecondary","icon","iconSmall","iconMedium","iconColorPrimary","iconColorSecondary","label","labelSmall","labelMedium","deleteIcon","deleteIconSmall","deleteIconMedium","deleteIconColorPrimary","deleteIconColorSecondary","deleteIconOutlinedColorPrimary","deleteIconOutlinedColorSecondary","deleteIconFilledColorPrimary","deleteIconFilledColorSecondary","focusVisible"]),Iee=["avatar","className","clickable","color","component","deleteIcon","disabled","icon","label","onClick","onDelete","onKeyDown","onKeyUp","size","variant","tabIndex","skipFocusWhenDisabled"],Pee=e=>{const{classes:t,disabled:n,size:r,color:o,iconColor:i,onDelete:s,clickable:a,variant:l}=e,c={root:["root",l,n&&"disabled",`size${ae(r)}`,`color${ae(o)}`,a&&"clickable",a&&`clickableColor${ae(o)}`,s&&"deletable",s&&`deletableColor${ae(o)}`,`${l}${ae(o)}`],label:["label",`label${ae(r)}`],avatar:["avatar",`avatar${ae(r)}`,`avatarColor${ae(o)}`],icon:["icon",`icon${ae(r)}`,`iconColor${ae(i)}`],deleteIcon:["deleteIcon",`deleteIcon${ae(r)}`,`deleteIconColor${ae(o)}`,`deleteIcon${ae(l)}Color${ae(o)}`]};return $t(c,Cee,t)},Ree=Me("div",{name:"MuiChip",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e,{color:r,iconColor:o,clickable:i,onDelete:s,size:a,variant:l}=n;return[{[`& .${Ke.avatar}`]:t.avatar},{[`& .${Ke.avatar}`]:t[`avatar${ae(a)}`]},{[`& .${Ke.avatar}`]:t[`avatarColor${ae(r)}`]},{[`& .${Ke.icon}`]:t.icon},{[`& .${Ke.icon}`]:t[`icon${ae(a)}`]},{[`& .${Ke.icon}`]:t[`iconColor${ae(o)}`]},{[`& .${Ke.deleteIcon}`]:t.deleteIcon},{[`& .${Ke.deleteIcon}`]:t[`deleteIcon${ae(a)}`]},{[`& .${Ke.deleteIcon}`]:t[`deleteIconColor${ae(r)}`]},{[`& .${Ke.deleteIcon}`]:t[`deleteIcon${ae(l)}Color${ae(r)}`]},t.root,t[`size${ae(a)}`],t[`color${ae(r)}`],i&&t.clickable,i&&r!=="default"&&t[`clickableColor${ae(r)})`],s&&t.deletable,s&&r!=="default"&&t[`deletableColor${ae(r)}`],t[l],t[`${l}${ae(r)}`]]}})(({theme:e,ownerState:t})=>{const n=e.palette.mode==="light"?e.palette.grey[700]:e.palette.grey[300];return N({maxWidth:"100%",fontFamily:e.typography.fontFamily,fontSize:e.typography.pxToRem(13),display:"inline-flex",alignItems:"center",justifyContent:"center",height:32,color:(e.vars||e).palette.text.primary,backgroundColor:(e.vars||e).palette.action.selected,borderRadius:32/2,whiteSpace:"nowrap",transition:e.transitions.create(["background-color","box-shadow"]),cursor:"unset",outline:0,textDecoration:"none",border:0,padding:0,verticalAlign:"middle",boxSizing:"border-box",[`&.${Ke.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity,pointerEvents:"none"},[`& .${Ke.avatar}`]:{marginLeft:5,marginRight:-6,width:24,height:24,color:e.vars?e.vars.palette.Chip.defaultAvatarColor:n,fontSize:e.typography.pxToRem(12)},[`& .${Ke.avatarColorPrimary}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.dark},[`& .${Ke.avatarColorSecondary}`]:{color:(e.vars||e).palette.secondary.contrastText,backgroundColor:(e.vars||e).palette.secondary.dark},[`& .${Ke.avatarSmall}`]:{marginLeft:4,marginRight:-4,width:18,height:18,fontSize:e.typography.pxToRem(10)},[`& .${Ke.icon}`]:N({marginLeft:5,marginRight:-6},t.size==="small"&&{fontSize:18,marginLeft:4,marginRight:-4},t.iconColor===t.color&&N({color:e.vars?e.vars.palette.Chip.defaultIconColor:n},t.color!=="default"&&{color:"inherit"})),[`& .${Ke.deleteIcon}`]:N({WebkitTapHighlightColor:"transparent",color:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / 0.26)`:wt(e.palette.text.primary,.26),fontSize:22,cursor:"pointer",margin:"0 5px 0 -6px","&:hover":{color:e.vars?`rgba(${e.vars.palette.text.primaryChannel} / 0.4)`:wt(e.palette.text.primary,.4)}},t.size==="small"&&{fontSize:16,marginRight:4,marginLeft:-4},t.color!=="default"&&{color:e.vars?`rgba(${e.vars.palette[t.color].contrastTextChannel} / 0.7)`:wt(e.palette[t.color].contrastText,.7),"&:hover, &:active":{color:(e.vars||e).palette[t.color].contrastText}})},t.size==="small"&&{height:24},t.color!=="default"&&{backgroundColor:(e.vars||e).palette[t.color].main,color:(e.vars||e).palette[t.color].contrastText},t.onDelete&&{[`&.${Ke.focusVisible}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.action.selectedChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:wt(e.palette.action.selected,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},t.onDelete&&t.color!=="default"&&{[`&.${Ke.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t.color].dark}})},({theme:e,ownerState:t})=>N({},t.clickable&&{userSelect:"none",WebkitTapHighlightColor:"transparent",cursor:"pointer","&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.selectedChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:wt(e.palette.action.selected,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity)},[`&.${Ke.focusVisible}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.action.selectedChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:wt(e.palette.action.selected,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)},"&:active":{boxShadow:(e.vars||e).shadows[1]}},t.clickable&&t.color!=="default"&&{[`&:hover, &.${Ke.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t.color].dark}}),({theme:e,ownerState:t})=>N({},t.variant==="outlined"&&{backgroundColor:"transparent",border:e.vars?`1px solid ${e.vars.palette.Chip.defaultBorder}`:`1px solid ${e.palette.mode==="light"?e.palette.grey[400]:e.palette.grey[700]}`,[`&.${Ke.clickable}:hover`]:{backgroundColor:(e.vars||e).palette.action.hover},[`&.${Ke.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`& .${Ke.avatar}`]:{marginLeft:4},[`& .${Ke.avatarSmall}`]:{marginLeft:2},[`& .${Ke.icon}`]:{marginLeft:4},[`& .${Ke.iconSmall}`]:{marginLeft:2},[`& .${Ke.deleteIcon}`]:{marginRight:5},[`& .${Ke.deleteIconSmall}`]:{marginRight:3}},t.variant==="outlined"&&t.color!=="default"&&{color:(e.vars||e).palette[t.color].main,border:`1px solid ${e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / 0.7)`:wt(e.palette[t.color].main,.7)}`,[`&.${Ke.clickable}:hover`]:{backgroundColor:e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:wt(e.palette[t.color].main,e.palette.action.hoverOpacity)},[`&.${Ke.focusVisible}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.focusOpacity})`:wt(e.palette[t.color].main,e.palette.action.focusOpacity)},[`& .${Ke.deleteIcon}`]:{color:e.vars?`rgba(${e.vars.palette[t.color].mainChannel} / 0.7)`:wt(e.palette[t.color].main,.7),"&:hover, &:active":{color:(e.vars||e).palette[t.color].main}}})),Aee=Me("span",{name:"MuiChip",slot:"Label",overridesResolver:(e,t)=>{const{ownerState:n}=e,{size:r}=n;return[t.label,t[`label${ae(r)}`]]}})(({ownerState:e})=>N({overflow:"hidden",textOverflow:"ellipsis",paddingLeft:12,paddingRight:12,whiteSpace:"nowrap"},e.variant==="outlined"&&{paddingLeft:11,paddingRight:11},e.size==="small"&&{paddingLeft:8,paddingRight:8},e.size==="small"&&e.variant==="outlined"&&{paddingLeft:7,paddingRight:7}));function RN(e){return e.key==="Backspace"||e.key==="Delete"}const $ee=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiChip"}),{avatar:o,className:i,clickable:s,color:a="default",component:l,deleteIcon:c,disabled:u=!1,icon:d,label:p,onClick:m,onDelete:h,onKeyDown:w,onKeyUp:v,size:f="medium",variant:g="filled",tabIndex:y,skipFocusWhenDisabled:_=!1}=r,E=xe(r,Iee),S=P.useRef(null),k=Lr(S,n),C=Z=>{Z.stopPropagation(),h&&h(Z)},O=Z=>{Z.currentTarget===Z.target&&RN(Z)&&Z.preventDefault(),w&&w(Z)},U=Z=>{Z.currentTarget===Z.target&&(h&&RN(Z)?h(Z):Z.key==="Escape"&&S.current&&S.current.blur()),v&&v(Z)},T=s!==!1&&m?!0:s,A=T||h?Ul:l||"div",L=N({},r,{component:A,disabled:u,size:f,color:a,iconColor:P.isValidElement(d)&&d.props.color||a,onDelete:!!h,clickable:T,variant:g}),j=Pee(L),q=A===Ul?N({component:l||"div",focusVisibleClassName:j.focusVisible},h&&{disableRipple:!0}):{};let K=null;h&&(K=c&&P.isValidElement(c)?P.cloneElement(c,{className:Se(c.props.className,j.deleteIcon),onClick:C}):R.jsx(xee,{className:Se(j.deleteIcon),onClick:C}));let J=null;o&&P.isValidElement(o)&&(J=P.cloneElement(o,{className:Se(j.avatar,o.props.className)}));let z=null;return d&&P.isValidElement(d)&&(z=P.cloneElement(d,{className:Se(j.icon,d.props.className)})),R.jsxs(Ree,N({as:A,className:Se(j.root,i),disabled:T&&u?!0:void 0,onClick:m,onKeyDown:O,onKeyUp:U,ref:k,tabIndex:_&&u?-1:y,ownerState:L},q,E,{children:[J||z,R.jsx(Aee,{className:Se(j.label),ownerState:L,children:p}),K]}))});function Oee({props:e,states:t,muiFormControl:n}){return t.reduce((r,o)=>(r[o]=e[o],n&&typeof e[o]>"u"&&(r[o]=n[o]),r),{})}const Nee=P.createContext(void 0);function AN(){return P.useContext(Nee)}const Lee=["addEndListener","appear","children","easing","in","onEnter","onEntered","onEntering","onExit","onExited","onExiting","style","timeout","TransitionComponent"],Mee={entering:{opacity:1},entered:{opacity:1}},$N=P.forwardRef(function(t,n){const r=cd(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{addEndListener:i,appear:s=!0,children:a,easing:l,in:c,onEnter:u,onEntered:d,onEntering:p,onExit:m,onExited:h,onExiting:w,style:v,timeout:f=o,TransitionComponent:g=ii}=t,y=xe(t,Lee),_=P.useRef(null),E=Lr(_,a.ref,n),S=j=>q=>{if(j){const K=_.current;q===void 0?j(K):j(K,q)}},k=S(p),C=S((j,q)=>{eZ(j);const K=q1({style:v,timeout:f,easing:l},{mode:"enter"});j.style.webkitTransition=r.transitions.create("opacity",K),j.style.transition=r.transitions.create("opacity",K),u&&u(j,q)}),O=S(d),U=S(w),T=S(j=>{const q=q1({style:v,timeout:f,easing:l},{mode:"exit"});j.style.webkitTransition=r.transitions.create("opacity",q),j.style.transition=r.transitions.create("opacity",q),m&&m(j)}),A=S(h),L=j=>{i&&i(_.current,j)};return R.jsx(g,N({appear:s,in:c,nodeRef:_,onEnter:C,onEntered:O,onEntering:k,onExit:T,onExited:A,onExiting:U,addEndListener:L,timeout:f},y,{children:(j,q)=>P.cloneElement(a,N({style:N({opacity:0,visibility:j==="exited"&&!c?"hidden":void 0},Mee[j],v,a.props.style),ref:E},q))}))});function Dee(e){return Ot("MuiBackdrop",e)}vt("MuiBackdrop",["root","invisible"]);const Uee=["children","className","component","components","componentsProps","invisible","open","slotProps","slots","TransitionComponent","transitionDuration"],jee=e=>{const{classes:t,invisible:n}=e;return $t({root:["root",n&&"invisible"]},Dee,t)},Wee=Me("div",{name:"MuiBackdrop",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.invisible&&t.invisible]}})(({ownerState:e})=>N({position:"fixed",display:"flex",alignItems:"center",justifyContent:"center",right:0,bottom:0,top:0,left:0,backgroundColor:"rgba(0, 0, 0, 0.5)",WebkitTapHighlightColor:"transparent"},e.invisible&&{backgroundColor:"transparent"})),ON=P.forwardRef(function(t,n){var r,o,i;const s=St({props:t,name:"MuiBackdrop"}),{children:a,className:l,component:c="div",components:u={},componentsProps:d={},invisible:p=!1,open:m,slotProps:h={},slots:w={},TransitionComponent:v=$N,transitionDuration:f}=s,g=xe(s,Uee),y=N({},s,{component:c,invisible:p}),_=jee(y),E=(r=h.root)!=null?r:d.root;return R.jsx(v,N({in:m,timeout:f},g,{children:R.jsx(Wee,N({"aria-hidden":!0},E,{as:(o=(i=w.root)!=null?i:u.Root)!=null?o:c,className:Se(_.root,l,E==null?void 0:E.className),ownerState:N({},y,E==null?void 0:E.ownerState),classes:_,ref:n,children:a}))}))}),Fee=vt("MuiBox",["root"]),zee=_E(),Bee=rZ({themeId:zs,defaultTheme:zee,defaultClassName:Fee.root,generateClassName:h1.generate});var Ae=we.forwardRef((e,t)=>we.createElement(Bee,{...e,ref:t}));function Gee(e){return Ot("PrivateSwitchBase",e)}vt("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const Hee=["autoFocus","checked","checkedIcon","className","defaultChecked","disabled","disableFocusRipple","edge","icon","id","inputProps","inputRef","name","onBlur","onChange","onFocus","readOnly","required","tabIndex","type","value"],qee=e=>{const{classes:t,checked:n,disabled:r,edge:o}=e,i={root:["root",n&&"checked",r&&"disabled",o&&`edge${ae(o)}`],input:["input"]};return $t(i,Gee,t)},Vee=Me(Ul)(({ownerState:e})=>N({padding:9,borderRadius:"50%"},e.edge==="start"&&{marginLeft:e.size==="small"?-3:-12},e.edge==="end"&&{marginRight:e.size==="small"?-3:-12})),Kee=Me("input",{shouldForwardProp:kh})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),Zee=P.forwardRef(function(t,n){const{autoFocus:r,checked:o,checkedIcon:i,className:s,defaultChecked:a,disabled:l,disableFocusRipple:c=!1,edge:u=!1,icon:d,id:p,inputProps:m,inputRef:h,name:w,onBlur:v,onChange:f,onFocus:g,readOnly:y,required:_=!1,tabIndex:E,type:S,value:k}=t,C=xe(t,Hee),[O,U]=zZ({controlled:o,default:!!a,name:"SwitchBase",state:"checked"}),T=AN(),A=Z=>{g&&g(Z),T&&T.onFocus&&T.onFocus(Z)},L=Z=>{v&&v(Z),T&&T.onBlur&&T.onBlur(Z)},j=Z=>{if(Z.nativeEvent.defaultPrevented)return;const W=Z.target.checked;U(W),f&&f(Z,W)};let q=l;T&&typeof q>"u"&&(q=T.disabled);const K=S==="checkbox"||S==="radio",J=N({},t,{checked:O,disabled:q,disableFocusRipple:c,edge:u}),z=qee(J);return R.jsxs(Vee,N({component:"span",className:Se(z.root,s),centerRipple:!0,focusRipple:!c,disabled:q,tabIndex:null,role:void 0,onFocus:A,onBlur:L,ownerState:J,ref:n},C,{children:[R.jsx(Kee,N({autoFocus:r,checked:o,defaultChecked:a,className:z.input,disabled:q,id:K?p:void 0,name:w,onChange:j,readOnly:y,ref:h,required:_,ownerState:J,tabIndex:E,type:S},S==="checkbox"&&k===void 0?{}:{value:k},m)),O?i:d]}))}),Yee=Oh(R.jsx("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlank"),Jee=Oh(R.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox"),Xee=Oh(R.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");function Qee(e){return Ot("MuiCheckbox",e)}const lS=vt("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),ete=["checkedIcon","color","icon","indeterminate","indeterminateIcon","inputProps","size","className"],tte=e=>{const{classes:t,indeterminate:n,color:r,size:o}=e,i={root:["root",n&&"indeterminate",`color${ae(r)}`,`size${ae(o)}`]},s=$t(i,Qee,t);return N({},t,s)},nte=Me(Zee,{shouldForwardProp:e=>kh(e)||e==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${ae(n.size)}`],n.color!=="default"&&t[`color${ae(n.color)}`]]}})(({theme:e,ownerState:t})=>N({color:(e.vars||e).palette.text.secondary},!t.disableRipple&&{"&:hover":{backgroundColor:e.vars?`rgba(${t.color==="default"?e.vars.palette.action.activeChannel:e.vars.palette[t.color].mainChannel} / ${e.vars.palette.action.hoverOpacity})`:wt(t.color==="default"?e.palette.action.active:e.palette[t.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},t.color!=="default"&&{[`&.${lS.checked}, &.${lS.indeterminate}`]:{color:(e.vars||e).palette[t.color].main},[`&.${lS.disabled}`]:{color:(e.vars||e).palette.action.disabled}})),rte=R.jsx(Jee,{}),ote=R.jsx(Yee,{}),ite=R.jsx(Xee,{}),ste=P.forwardRef(function(t,n){var r,o;const i=St({props:t,name:"MuiCheckbox"}),{checkedIcon:s=rte,color:a="primary",icon:l=ote,indeterminate:c=!1,indeterminateIcon:u=ite,inputProps:d,size:p="medium",className:m}=i,h=xe(i,ete),w=c?u:l,v=c?u:s,f=N({},i,{color:a,indeterminate:c,size:p}),g=tte(f);return R.jsx(nte,N({type:"checkbox",inputProps:N({"data-indeterminate":c},d),icon:P.cloneElement(w,{fontSize:(r=w.props.fontSize)!=null?r:p}),checkedIcon:P.cloneElement(v,{fontSize:(o=v.props.fontSize)!=null?o:p}),ownerState:f,ref:n,className:Se(g.root,m)},h,{classes:g}))});var ate=we.forwardRef((e,t)=>we.createElement(ste,{...e,ref:t}));const lte=GE($ee)(({theme:e,ownerState:t})=>t.shape!=="rounded"?null:{borderRadius:e.shape.borderRadius*e.shape.__unstableBorderRadiusMultipliers[1]}),NN={shape:"pill"},LN=we.forwardRef((e,t)=>{const{shape:n,...r}={...NN,...e};return we.createElement(lte,{...r,ref:t,ownerState:{shape:n}})});LN.defaultProps=NN;var cte=LN;function ute(e){return Ot("MuiDialogContent",e)}vt("MuiDialogContent",["root","dividers"]);function dte(e){return Ot("MuiDialogTitle",e)}const pte=vt("MuiDialogTitle",["root"]),fte=["className","dividers"],mte=e=>{const{classes:t,dividers:n}=e;return $t({root:["root",n&&"dividers"]},ute,t)},hte=Me("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(({theme:e,ownerState:t})=>N({flex:"1 1 auto",WebkitOverflowScrolling:"touch",overflowY:"auto",padding:"20px 24px"},t.dividers?{padding:"16px 24px",borderTop:`1px solid ${(e.vars||e).palette.divider}`,borderBottom:`1px solid ${(e.vars||e).palette.divider}`}:{[`.${pte.root} + &`]:{paddingTop:0}})),gte=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiDialogContent"}),{className:o,dividers:i=!1}=r,s=xe(r,fte),a=N({},r,{dividers:i}),l=mte(a);return R.jsx(hte,N({className:Se(l.root,o),ownerState:a,ref:n},s))});function yte(e){return Ot("MuiModal",e)}vt("MuiModal",["root","hidden","backdrop"]);const wte=["BackdropComponent","BackdropProps","classes","className","closeAfterTransition","children","container","component","components","componentsProps","disableAutoFocus","disableEnforceFocus","disableEscapeKeyDown","disablePortal","disableRestoreFocus","disableScrollLock","hideBackdrop","keepMounted","onBackdropClick","onClose","onTransitionEnter","onTransitionExited","open","slotProps","slots","theme"],vte=e=>{const{open:t,exited:n,classes:r}=e;return $t({root:["root",!t&&n&&"hidden"],backdrop:["backdrop"]},yte,r)},_te=Me("div",{name:"MuiModal",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.open&&n.exited&&t.hidden]}})(({theme:e,ownerState:t})=>N({position:"fixed",zIndex:(e.vars||e).zIndex.modal,right:0,bottom:0,top:0,left:0},!t.open&&t.exited&&{visibility:"hidden"})),bte=Me(ON,{name:"MuiModal",slot:"Backdrop",overridesResolver:(e,t)=>t.backdrop})({zIndex:-1}),Ete=P.forwardRef(function(t,n){var r,o,i,s,a,l;const c=St({name:"MuiModal",props:t}),{BackdropComponent:u=bte,BackdropProps:d,className:p,closeAfterTransition:m=!1,children:h,container:w,component:v,components:f={},componentsProps:g={},disableAutoFocus:y=!1,disableEnforceFocus:_=!1,disableEscapeKeyDown:E=!1,disablePortal:S=!1,disableRestoreFocus:k=!1,disableScrollLock:C=!1,hideBackdrop:O=!1,keepMounted:U=!1,onBackdropClick:T,open:A,slotProps:L,slots:j}=c,q=xe(c,wte),K=N({},c,{closeAfterTransition:m,disableAutoFocus:y,disableEnforceFocus:_,disableEscapeKeyDown:E,disablePortal:S,disableRestoreFocus:k,disableScrollLock:C,hideBackdrop:O,keepMounted:U}),{getRootProps:J,getBackdropProps:z,getTransitionProps:Z,portalRef:W,isTopModal:$,exited:G,hasTransition:D}=tQ(N({},K,{rootRef:n})),x=N({},K,{exited:G}),I=vte(x),F={};if(h.props.tabIndex===void 0&&(F.tabIndex="-1"),D){const{onEnter:gn,onExited:yr}=Z();F.onEnter=gn,F.onExited=yr}const ne=(r=(o=j==null?void 0:j.root)!=null?o:f.Root)!=null?r:_te,re=(i=(s=j==null?void 0:j.backdrop)!=null?s:f.Backdrop)!=null?i:u,be=(a=L==null?void 0:L.root)!=null?a:g.root,$e=(l=L==null?void 0:L.backdrop)!=null?l:g.backdrop,it=WE({elementType:ne,externalSlotProps:be,externalForwardedProps:q,getSlotProps:J,additionalProps:{ref:n,as:v},ownerState:x,className:Se(p,be==null?void 0:be.className,I==null?void 0:I.root,!x.open&&x.exited&&(I==null?void 0:I.hidden))}),er=WE({elementType:re,externalSlotProps:$e,additionalProps:d,getSlotProps:gn=>z(N({},gn,{onClick:yr=>{T&&T(yr),gn!=null&&gn.onClick&&gn.onClick(yr)}})),className:Se($e==null?void 0:$e.className,d==null?void 0:d.className,I==null?void 0:I.backdrop),ownerState:x});return!U&&!A&&(!D||G)?null:R.jsx(aN,{ref:W,container:w,disablePortal:S,children:R.jsxs(ne,N({},it,{children:[!O&&u?R.jsx(re,N({},er)):null,R.jsx(HX,{disableEnforceFocus:_,disableAutoFocus:y,disableRestoreFocus:k,isEnabled:$,open:A,children:P.cloneElement(h,F)})]}))})});function Ste(e){return Ot("MuiDialog",e)}const cS=vt("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),MN=P.createContext({}),Tte=["aria-describedby","aria-labelledby","BackdropComponent","BackdropProps","children","className","disableEscapeKeyDown","fullScreen","fullWidth","maxWidth","onBackdropClick","onClick","onClose","open","PaperComponent","PaperProps","scroll","TransitionComponent","transitionDuration","TransitionProps"],kte=Me(ON,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),xte=e=>{const{classes:t,scroll:n,maxWidth:r,fullWidth:o,fullScreen:i}=e,s={root:["root"],container:["container",`scroll${ae(n)}`],paper:["paper",`paperScroll${ae(n)}`,`paperWidth${ae(String(r))}`,o&&"paperFullWidth",i&&"paperFullScreen"]};return $t(s,Ste,t)},Cte=Me(Ete,{name:"MuiDialog",slot:"Root",overridesResolver:(e,t)=>t.root})({"@media print":{position:"absolute !important"}}),Ite=Me("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.container,t[`scroll${ae(n.scroll)}`]]}})(({ownerState:e})=>N({height:"100%","@media print":{height:"auto"},outline:0},e.scroll==="paper"&&{display:"flex",justifyContent:"center",alignItems:"center"},e.scroll==="body"&&{overflowY:"auto",overflowX:"hidden",textAlign:"center","&::after":{content:'""',display:"inline-block",verticalAlign:"middle",height:"100%",width:"0"}})),Pte=Me(iO,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`scrollPaper${ae(n.scroll)}`],t[`paperWidth${ae(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(({theme:e,ownerState:t})=>N({margin:32,position:"relative",overflowY:"auto","@media print":{overflowY:"visible",boxShadow:"none"}},t.scroll==="paper"&&{display:"flex",flexDirection:"column",maxHeight:"calc(100% - 64px)"},t.scroll==="body"&&{display:"inline-block",verticalAlign:"middle",textAlign:"left"},!t.maxWidth&&{maxWidth:"calc(100% - 64px)"},t.maxWidth==="xs"&&{maxWidth:e.breakpoints.unit==="px"?Math.max(e.breakpoints.values.xs,444):`max(${e.breakpoints.values.xs}${e.breakpoints.unit}, 444px)`,[`&.${cS.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+32*2)]:{maxWidth:"calc(100% - 64px)"}}},t.maxWidth&&t.maxWidth!=="xs"&&{maxWidth:`${e.breakpoints.values[t.maxWidth]}${e.breakpoints.unit}`,[`&.${cS.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t.maxWidth]+32*2)]:{maxWidth:"calc(100% - 64px)"}}},t.fullWidth&&{width:"calc(100% - 64px)"},t.fullScreen&&{margin:0,width:"100%",maxWidth:"100%",height:"100%",maxHeight:"none",borderRadius:0,[`&.${cS.paperScrollBody}`]:{margin:0,maxWidth:"100%"}})),Rte=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiDialog"}),o=cd(),i={enter:o.transitions.duration.enteringScreen,exit:o.transitions.duration.leavingScreen},{"aria-describedby":s,"aria-labelledby":a,BackdropComponent:l,BackdropProps:c,children:u,className:d,disableEscapeKeyDown:p=!1,fullScreen:m=!1,fullWidth:h=!1,maxWidth:w="sm",onBackdropClick:v,onClick:f,onClose:g,open:y,PaperComponent:_=iO,PaperProps:E={},scroll:S="paper",TransitionComponent:k=$N,transitionDuration:C=i,TransitionProps:O}=r,U=xe(r,Tte),T=N({},r,{disableEscapeKeyDown:p,fullScreen:m,fullWidth:h,maxWidth:w,scroll:S}),A=xte(T),L=P.useRef(),j=z=>{L.current=z.target===z.currentTarget},q=z=>{f&&f(z),L.current&&(L.current=null,v&&v(z),g&&g(z,"backdropClick"))},K=FZ(a),J=P.useMemo(()=>({titleId:K}),[K]);return R.jsx(Cte,N({className:Se(A.root,d),closeAfterTransition:!0,components:{Backdrop:kte},componentsProps:{backdrop:N({transitionDuration:C,as:l},c)},disableEscapeKeyDown:p,onClose:g,open:y,ref:n,onClick:q,ownerState:T},U,{children:R.jsx(k,N({appear:!0,in:y,timeout:C,role:"presentation"},O,{children:R.jsx(Ite,{className:Se(A.container),onMouseDown:j,ownerState:T,children:R.jsx(Pte,N({as:_,elevation:24,role:"dialog","aria-describedby":s,"aria-labelledby":K},E,{className:Se(A.paper,E.className),ownerState:T,children:R.jsx(MN.Provider,{value:J,children:u})}))})}))}))});function Ate(e){return Ot("MuiDialogActions",e)}vt("MuiDialogActions",["root","spacing"]);const $te=["className","disableSpacing"],Ote=e=>{const{classes:t,disableSpacing:n}=e;return $t({root:["root",!n&&"spacing"]},Ate,t)},Nte=Me("div",{name:"MuiDialogActions",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableSpacing&&t.spacing]}})(({ownerState:e})=>N({display:"flex",alignItems:"center",padding:8,justifyContent:"flex-end",flex:"0 0 auto"},!e.disableSpacing&&{"& > :not(style) ~ :not(style)":{marginLeft:8}})),Lte=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiDialogActions"}),{className:o,disableSpacing:i=!1}=r,s=xe(r,$te),a=N({},r,{disableSpacing:i}),l=Ote(a);return R.jsx(Nte,N({className:Se(l.root,o),ownerState:a,ref:n},s))});function Mte(e){return Ot("MuiList",e)}vt("MuiList",["root","padding","dense","subheader"]);const Dte=["children","className","component","dense","disablePadding","subheader"],Ute=e=>{const{classes:t,disablePadding:n,dense:r,subheader:o}=e;return $t({root:["root",!n&&"padding",r&&"dense",o&&"subheader"]},Mte,t)},jte=Me("ul",{name:"MuiList",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disablePadding&&t.padding,n.dense&&t.dense,n.subheader&&t.subheader]}})(({ownerState:e})=>N({listStyle:"none",margin:0,padding:0,position:"relative"},!e.disablePadding&&{paddingTop:8,paddingBottom:8},e.subheader&&{paddingTop:0})),Wte=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiList"}),{children:o,className:i,component:s="ul",dense:a=!1,disablePadding:l=!1,subheader:c}=r,u=xe(r,Dte),d=P.useMemo(()=>({dense:a}),[a]),p=N({},r,{component:s,dense:a,disablePadding:l}),m=Ute(p);return R.jsx(ud.Provider,{value:d,children:R.jsxs(jte,N({as:s,className:Se(m.root,i),ref:n,ownerState:p},u,{children:[c,o]}))})});function Fte(e){return Ot("MuiListItem",e)}const Vl=vt("MuiListItem",["root","container","focusVisible","dense","alignItemsFlexStart","disabled","divider","gutters","padding","button","secondaryAction","selected"]),zte=vt("MuiListItemButton",["root","focusVisible","dense","alignItemsFlexStart","disabled","divider","gutters","selected"]);function Bte(e){return Ot("MuiListItemSecondaryAction",e)}vt("MuiListItemSecondaryAction",["root","disableGutters"]);const Gte=["className"],Hte=e=>{const{disableGutters:t,classes:n}=e;return $t({root:["root",t&&"disableGutters"]},Bte,n)},qte=Me("div",{name:"MuiListItemSecondaryAction",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.disableGutters&&t.disableGutters]}})(({ownerState:e})=>N({position:"absolute",right:16,top:"50%",transform:"translateY(-50%)"},e.disableGutters&&{right:0})),DN=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiListItemSecondaryAction"}),{className:o}=r,i=xe(r,Gte),s=P.useContext(ud),a=N({},r,{disableGutters:s.disableGutters}),l=Hte(a);return R.jsx(qte,N({className:Se(l.root,o),ownerState:a,ref:n},i))});DN.muiName="ListItemSecondaryAction";const Vte=["className"],Kte=["alignItems","autoFocus","button","children","className","component","components","componentsProps","ContainerComponent","ContainerProps","dense","disabled","disableGutters","disablePadding","divider","focusVisibleClassName","secondaryAction","selected","slotProps","slots"],Zte=(e,t)=>{const{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.alignItems==="flex-start"&&t.alignItemsFlexStart,n.divider&&t.divider,!n.disableGutters&&t.gutters,!n.disablePadding&&t.padding,n.button&&t.button,n.hasSecondaryAction&&t.secondaryAction]},Yte=e=>{const{alignItems:t,button:n,classes:r,dense:o,disabled:i,disableGutters:s,disablePadding:a,divider:l,hasSecondaryAction:c,selected:u}=e;return $t({root:["root",o&&"dense",!s&&"gutters",!a&&"padding",l&&"divider",i&&"disabled",n&&"button",t==="flex-start"&&"alignItemsFlexStart",c&&"secondaryAction",u&&"selected"],container:["container"]},Fte,r)},Jte=Me("div",{name:"MuiListItem",slot:"Root",overridesResolver:Zte})(({theme:e,ownerState:t})=>N({display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",width:"100%",boxSizing:"border-box",textAlign:"left"},!t.disablePadding&&N({paddingTop:8,paddingBottom:8},t.dense&&{paddingTop:4,paddingBottom:4},!t.disableGutters&&{paddingLeft:16,paddingRight:16},!!t.secondaryAction&&{paddingRight:48}),!!t.secondaryAction&&{[`& > .${zte.root}`]:{paddingRight:48}},{[`&.${Vl.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Vl.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:wt(e.palette.primary.main,e.palette.action.selectedOpacity),[`&.${Vl.focusVisible}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:wt(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},[`&.${Vl.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity}},t.alignItems==="flex-start"&&{alignItems:"flex-start"},t.divider&&{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"},t.button&&{transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest}),"&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Vl.selected}:hover`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:wt(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:wt(e.palette.primary.main,e.palette.action.selectedOpacity)}}},t.hasSecondaryAction&&{paddingRight:48})),Xte=Me("li",{name:"MuiListItem",slot:"Container",overridesResolver:(e,t)=>t.container})({position:"relative"}),Qte=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiListItem"}),{alignItems:o="center",autoFocus:i=!1,button:s=!1,children:a,className:l,component:c,components:u={},componentsProps:d={},ContainerComponent:p="li",ContainerProps:{className:m}={},dense:h=!1,disabled:w=!1,disableGutters:v=!1,disablePadding:f=!1,divider:g=!1,focusVisibleClassName:y,secondaryAction:_,selected:E=!1,slotProps:S={},slots:k={}}=r,C=xe(r.ContainerProps,Vte),O=xe(r,Kte),U=P.useContext(ud),T=P.useMemo(()=>({dense:h||U.dense||!1,alignItems:o,disableGutters:v}),[o,U.dense,h,v]),A=P.useRef(null);Ml(()=>{i&&A.current&&A.current.focus()},[i]);const L=P.Children.toArray(a),j=L.length&&jZ(L[L.length-1],["ListItemSecondaryAction"]),q=N({},r,{alignItems:o,autoFocus:i,button:s,dense:T.dense,disabled:w,disableGutters:v,disablePadding:f,divider:g,hasSecondaryAction:j,selected:E}),K=Yte(q),J=Lr(A,n),z=k.root||u.Root||Jte,Z=S.root||d.root||{},W=N({className:Se(K.root,Z.className,l),disabled:w},O);let $=c||"li";return s&&(W.component=c||"div",W.focusVisibleClassName=Se(Vl.focusVisible,y),$=Ul),j?($=!W.component&&!c?"div":$,p==="li"&&($==="li"?$="div":W.component==="li"&&(W.component="div")),R.jsx(ud.Provider,{value:T,children:R.jsxs(Xte,N({as:p,className:Se(K.container,m),ref:J,ownerState:q},C,{children:[R.jsx(z,N({},Z,!jE(z)&&{as:$,ownerState:N({},q,Z.ownerState)},W,{children:L})),L.pop()]}))})):R.jsx(ud.Provider,{value:T,children:R.jsxs(z,N({},Z,{as:$,ref:J},!jE(z)&&{ownerState:N({},q,Z.ownerState)},W,{children:[L,_&&R.jsx(DN,{children:_})]}))})}),UN=UZ({createStyledComponent:Me("div",{name:"MuiStack",slot:"Root",overridesResolver:(e,t)=>t.root}),useThemeProps:e=>St({props:e,name:"MuiStack"})});var jN=we.forwardRef((e,t)=>we.createElement(UN,{...e,ref:t}));const uS={variantMapping:{display1:"h1",display2:"h2",display3:"h3",display4:"h4",display5:"h5",display6:"h6"}},WN=we.forwardRef((e,t)=>{const n={...uS,...e,variantMapping:{...uS.variantMapping,...e.variantMapping}};return we.createElement(hd,{...n,ref:t})});WN.defaultProps=uS;var Zt=WN,FN=we.forwardRef((e,t)=>we.createElement(Rte,{...e,ref:t})),zN=we.forwardRef((e,t)=>we.createElement(Lte,{...e,ref:t})),BN=we.forwardRef((e,t)=>we.createElement(gte,{...e,ref:t}));const ene=["className","id"],tne=e=>{const{classes:t}=e;return $t({root:["root"]},dte,t)},nne=Me(hd,{name:"MuiDialogTitle",slot:"Root",overridesResolver:(e,t)=>t.root})({padding:"16px 24px",flex:"0 0 auto"}),rne=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiDialogTitle"}),{className:o,id:i}=r,s=xe(r,ene),a=r,l=tne(a),{titleId:c=i}=P.useContext(MN);return R.jsx(nne,N({component:"h2",className:Se(l.root,o),ownerState:a,ref:n,variant:"h6",id:i??c},s))}),GN={variant:"subtitle1"},HN=we.forwardRef((e,t)=>we.createElement(rne,{...GN,...e,ref:t}));HN.defaultProps=GN;var qN=HN;function one(e){return Ot("MuiDivider",e)}vt("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);const ine=["absolute","children","className","component","flexItem","light","orientation","role","textAlign","variant"],sne=e=>{const{absolute:t,children:n,classes:r,flexItem:o,light:i,orientation:s,textAlign:a,variant:l}=e;return $t({root:["root",t&&"absolute",l,i&&"light",s==="vertical"&&"vertical",o&&"flexItem",n&&"withChildren",n&&s==="vertical"&&"withChildrenVertical",a==="right"&&s!=="vertical"&&"textAlignRight",a==="left"&&s!=="vertical"&&"textAlignLeft"],wrapper:["wrapper",s==="vertical"&&"wrapperVertical"]},one,r)},ane=Me("div",{name:"MuiDivider",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.absolute&&t.absolute,t[n.variant],n.light&&t.light,n.orientation==="vertical"&&t.vertical,n.flexItem&&t.flexItem,n.children&&t.withChildren,n.children&&n.orientation==="vertical"&&t.withChildrenVertical,n.textAlign==="right"&&n.orientation!=="vertical"&&t.textAlignRight,n.textAlign==="left"&&n.orientation!=="vertical"&&t.textAlignLeft]}})(({theme:e,ownerState:t})=>N({margin:0,flexShrink:0,borderWidth:0,borderStyle:"solid",borderColor:(e.vars||e).palette.divider,borderBottomWidth:"thin"},t.absolute&&{position:"absolute",bottom:0,left:0,width:"100%"},t.light&&{borderColor:e.vars?`rgba(${e.vars.palette.dividerChannel} / 0.08)`:wt(e.palette.divider,.08)},t.variant==="inset"&&{marginLeft:72},t.variant==="middle"&&t.orientation==="horizontal"&&{marginLeft:e.spacing(2),marginRight:e.spacing(2)},t.variant==="middle"&&t.orientation==="vertical"&&{marginTop:e.spacing(1),marginBottom:e.spacing(1)},t.orientation==="vertical"&&{height:"100%",borderBottomWidth:0,borderRightWidth:"thin"},t.flexItem&&{alignSelf:"stretch",height:"auto"}),({ownerState:e})=>N({},e.children&&{display:"flex",whiteSpace:"nowrap",textAlign:"center",border:0,"&::before, &::after":{content:'""',alignSelf:"center"}}),({theme:e,ownerState:t})=>N({},t.children&&t.orientation!=="vertical"&&{"&::before, &::after":{width:"100%",borderTop:`thin solid ${(e.vars||e).palette.divider}`}}),({theme:e,ownerState:t})=>N({},t.children&&t.orientation==="vertical"&&{flexDirection:"column","&::before, &::after":{height:"100%",borderLeft:`thin solid ${(e.vars||e).palette.divider}`}}),({ownerState:e})=>N({},e.textAlign==="right"&&e.orientation!=="vertical"&&{"&::before":{width:"90%"},"&::after":{width:"10%"}},e.textAlign==="left"&&e.orientation!=="vertical"&&{"&::before":{width:"10%"},"&::after":{width:"90%"}})),lne=Me("span",{name:"MuiDivider",slot:"Wrapper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.wrapper,n.orientation==="vertical"&&t.wrapperVertical]}})(({theme:e,ownerState:t})=>N({display:"inline-block",paddingLeft:`calc(${e.spacing(1)} * 1.2)`,paddingRight:`calc(${e.spacing(1)} * 1.2)`},t.orientation==="vertical"&&{paddingTop:`calc(${e.spacing(1)} * 1.2)`,paddingBottom:`calc(${e.spacing(1)} * 1.2)`})),VN=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiDivider"}),{absolute:o=!1,children:i,className:s,component:a=i?"div":"hr",flexItem:l=!1,light:c=!1,orientation:u="horizontal",role:d=a!=="hr"?"separator":void 0,textAlign:p="center",variant:m="fullWidth"}=r,h=xe(r,ine),w=N({},r,{absolute:o,component:a,flexItem:l,light:c,orientation:u,role:d,textAlign:p,variant:m}),v=sne(w);return R.jsx(ane,N({as:a,className:Se(v.root,s),role:d,ref:n,ownerState:w},h,{children:i?R.jsx(lne,{className:v.wrapper,ownerState:w,children:i}):null}))});VN.muiSkipListHighlight=!0;var Td=we.forwardRef((e,t)=>we.createElement(VN,{...e,ref:t}));function cne(e){return Ot("MuiFormControlLabel",e)}const kd=vt("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error","required","asterisk"]),une=["checked","className","componentsProps","control","disabled","disableTypography","inputRef","label","labelPlacement","name","onChange","required","slotProps","value"],dne=e=>{const{classes:t,disabled:n,labelPlacement:r,error:o,required:i}=e,s={root:["root",n&&"disabled",`labelPlacement${ae(r)}`,o&&"error",i&&"required"],label:["label",n&&"disabled"],asterisk:["asterisk",o&&"error"]};return $t(s,cne,t)},pne=Me("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${kd.label}`]:t.label},t.root,t[`labelPlacement${ae(n.labelPlacement)}`]]}})(({theme:e,ownerState:t})=>N({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,[`&.${kd.disabled}`]:{cursor:"default"}},t.labelPlacement==="start"&&{flexDirection:"row-reverse",marginLeft:16,marginRight:-11},t.labelPlacement==="top"&&{flexDirection:"column-reverse",marginLeft:16},t.labelPlacement==="bottom"&&{flexDirection:"column",marginLeft:16},{[`& .${kd.label}`]:{[`&.${kd.disabled}`]:{color:(e.vars||e).palette.text.disabled}}})),fne=Me("span",{name:"MuiFormControlLabel",slot:"Asterisk",overridesResolver:(e,t)=>t.asterisk})(({theme:e})=>({[`&.${kd.error}`]:{color:(e.vars||e).palette.error.main}})),mne=P.forwardRef(function(t,n){var r,o;const i=St({props:t,name:"MuiFormControlLabel"}),{className:s,componentsProps:a={},control:l,disabled:c,disableTypography:u,label:d,labelPlacement:p="end",required:m,slotProps:h={}}=i,w=xe(i,une),v=AN(),f=(r=c??l.props.disabled)!=null?r:v==null?void 0:v.disabled,g=m??l.props.required,y={disabled:f,required:g};["checked","name","onChange","value","inputRef"].forEach(O=>{typeof l.props[O]>"u"&&typeof i[O]<"u"&&(y[O]=i[O])});const _=Oee({props:i,muiFormControl:v,states:["error"]}),E=N({},i,{disabled:f,labelPlacement:p,required:g,error:_.error}),S=dne(E),k=(o=h.typography)!=null?o:a.typography;let C=d;return C!=null&&C.type!==hd&&!u&&(C=R.jsx(hd,N({component:"span"},k,{className:Se(S.label,k==null?void 0:k.className),children:C}))),R.jsxs(pne,N({className:Se(S.root,s),ownerState:E,ref:n},w,{children:[P.cloneElement(l,y),g?R.jsxs(UN,{display:"block",children:[C,R.jsxs(fne,{ownerState:E,"aria-hidden":!0,className:S.asterisk,children:[" ","*"]})]}):C]}))});var hne=we.forwardRef((e,t)=>we.createElement(mne,{...e,ref:t})),gne=we.forwardRef((e,t)=>we.createElement(kee,{...e,ref:t}));function yne(e){return Ot("MuiLink",e)}const wne=vt("MuiLink",["root","underlineNone","underlineHover","underlineAlways","button","focusVisible"]),KN={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},vne=e=>KN[e]||e,_ne=({theme:e,ownerState:t})=>{const n=vne(t.color),r=gl(e,`palette.${n}`,!1)||t.color,o=gl(e,`palette.${n}Channel`);return"vars"in e&&o?`rgba(${o} / 0.4)`:wt(r,.4)},bne=["className","color","component","onBlur","onFocus","TypographyClasses","underline","variant","sx"],Ene=e=>{const{classes:t,component:n,focusVisible:r,underline:o}=e,i={root:["root",`underline${ae(o)}`,n==="button"&&"button",r&&"focusVisible"]};return $t(i,yne,t)},Sne=Me(hd,{name:"MuiLink",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`underline${ae(n.underline)}`],n.component==="button"&&t.button]}})(({theme:e,ownerState:t})=>N({},t.underline==="none"&&{textDecoration:"none"},t.underline==="hover"&&{textDecoration:"none","&:hover":{textDecoration:"underline"}},t.underline==="always"&&N({textDecoration:"underline"},t.color!=="inherit"&&{textDecorationColor:_ne({theme:e,ownerState:t})},{"&:hover":{textDecorationColor:"inherit"}}),t.component==="button"&&{position:"relative",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none","&::-moz-focus-inner":{borderStyle:"none"},[`&.${wne.focusVisible}`]:{outline:"auto"}})),Tne=P.forwardRef(function(t,n){const r=St({props:t,name:"MuiLink"}),{className:o,color:i="primary",component:s="a",onBlur:a,onFocus:l,TypographyClasses:c,underline:u="always",variant:d="inherit",sx:p}=r,m=xe(r,bne),{isFocusVisibleRef:h,onBlur:w,onFocus:v,ref:f}=nO(),[g,y]=P.useState(!1),_=Lr(n,f),E=O=>{w(O),h.current===!1&&y(!1),a&&a(O)},S=O=>{v(O),h.current===!0&&y(!0),l&&l(O)},k=N({},r,{color:i,component:s,focusVisible:g,underline:u,variant:d}),C=Ene(k);return R.jsx(Sne,N({color:i,className:Se(C.root,o),classes:c,component:s,onBlur:E,onFocus:S,ref:_,ownerState:k,variant:d,sx:[...Object.keys(KN).includes(i)?[]:[{color:i}],...Array.isArray(p)?p:[p]]},m))}),kne={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},xne=GE(Tne)(()=>({cursor:"pointer"})),Cne=(e,t)=>{var n;return t.palette.primary.__unstableAccessibleMain&&(e==="primary.main"||e==="primary")?`primary.${hr}`:(n=t.palette.global)!=null&&n.__unstableAccessibleMain&&e==="global.main"?`global.${hr}`:kne[e]||e},ZN={color:"primary.main"},YN=we.forwardRef((e,t)=>{const{sx:n={},...r}={...ZN,...e},o=cd(),i=Cne(r.color,o);return we.createElement(xne,{...r,color:i,sx:{[jl]:{color:i},...n},ref:t})});YN.defaultProps=ZN;var JN=YN,Ine=we.forwardRef((e,t)=>we.createElement(Wte,{...e,ref:t})),XN=we.forwardRef((e,t)=>we.createElement(Qte,{...e,ref:t}));function Pne(){return R.jsx(Ae,{className:"angie-dev-mode-border-overlay"})}const Rne="angie/integration/track",rt=(e,t={})=>{try{const n=zn();if(!(n!=null&&n.contentWindow))return;const r={eventName:e,properties:t};n.contentWindow.postMessage({type:Rne,payload:r},"https://angie.elementor.com")}catch(n){console.error("Failed to send integration tracking event:",n)}},og={ENTERED:"test_mode_entered",EXITED:"test_mode_exited",ERROR:"test_mode_error",RECOVERY_TRIGGERED:"test_mode_recovery_triggered"},Zs={CREATED:"widget_created_test_mode",PUBLISHED_TO_PROD:"widget_published_to_prod",REFINED:"widget_refined_count",CRASHED_SITE:"widget_crashed_site"},Xi={API_ERROR:"api_error"},Xn={ASK_FOR_DETAILS:"ask-for-snippet-details",CREATE_SNIPPET:"create-snippet",UPDATE_FILES:"update-snippet-files",SET_DEV_MODE:"set-dev-mode",DEPLOY_SNIPPET:"deploy-snippet",UPDATE_SNIPPET:"update-snippet",PUBLISH:"publish-snippet",DELETE:"delete-code-snippet"},QN={PUBLISH_PAGE_CLICKED:"publish_modal_publish_page_clicked",PUBLISH_WIDGET_AND_PAGE_CLICKED:"publish_modal_publish_widget_and_page_clicked"},dS={PUBLISH_PAGE:"publish_page",PUBLISH_WIDGET_AND_PAGE:"publish_widget_and_page"},eL={EXIT_CLICKED:"exit_test_mode_modal_exit_clicked",BACK_CLICKED:"exit_test_mode_modal_back_clicked"},ig={EXIT:"exit",BACK:"back"},tL={FLOATING_BUTTON:"floating_button",CHAT_INTERFACE:"chat_interface"},sg={MCP_APP:"mcp_app",TEST_MODE_MODAL:"test_mode_modal",CHAT:"chat",UI:"ui",EDITOR_PUBLISH_MODAL:"editor_publish_modal"},xd={SESSION_ENTRY_TIME:"angie_test_mode_entry_time",REFINEMENT_COUNTS:"angie_snippet_refinement_counts",ACTIVE_SNIPPET_SLUG:"angie_active_snippet_slug"},Ane=()=>{const e=sessionStorage.getItem(xd.SESSION_ENTRY_TIME);return e?parseInt(e,10):null},$ne=()=>{try{const e=sessionStorage.getItem(xd.REFINEMENT_COUNTS);return e?JSON.parse(e):{}}catch(e){return console.warn("Failed to read refinement counts",e),{}}},One=e=>{try{sessionStorage.setItem(xd.REFINEMENT_COUNTS,JSON.stringify(e))}catch(t){console.warn("Failed to write refinement counts",t)}},nL=({source:e,snippetSlug:t})=>{sessionStorage.setItem(xd.SESSION_ENTRY_TIME,Date.now().toString()),rt(og.ENTERED,{source:e,snippet_slug:t})},ag=({source:e,exitReason:t,snippetSlug:n})=>{const r=Ane(),o=r?Math.floor((Date.now()-r)/1e3):0;rt(og.EXITED,{source:e,exit_reason:t,snippet_slug:n,duration_seconds:o}),sessionStorage.removeItem(xd.SESSION_ENTRY_TIME)},rL=e=>{rt(Zs.CREATED,{source:e.source,snippet_slug:e.snippetSlug,snippet_id:e.snippetId,snippet_type:e.snippetType,file_count:e.fileCount,...e.artifactId!==void 0&&{artifact_id:e.artifactId}})},lg=e=>{const t=String(e.snippetId||e.snippetSlug),n=$ne(),r=(n[t]||0)+1;n[t]=r,One(n),rt(Zs.REFINED,{source:e.source,snippet_slug:e.snippetSlug,snippet_id:e.snippetId,is_overwrite:e.isOverwrite,refinement_count:r,...e.artifactId!==void 0&&{artifact_id:e.artifactId}})},Nne=()=>`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`,oL=e=>e>1?Nne():void 0,cg=e=>{const t={source:e.source,snippet_slug:e.snippetSlug,snippet_id:e.snippetId,snippet_type:e.snippetType,publish_source:e.publishSource};e.interactionId!==void 0&&(t.interaction_id=e.interactionId),e.artifactId!==void 0&&(t.artifact_id=e.artifactId),rt(Zs.PUBLISHED_TO_PROD,t)},Qi=e=>{rt(og.ERROR,{source:e.source,error_type:e.errorType,tool_name:e.toolName,snippet_slug:e.snippetSlug,snippet_id:e.snippetId,error_message:e.errorMessage})},Lne=e=>{const t=e.action===dS.PUBLISH_PAGE?QN.PUBLISH_PAGE_CLICKED:QN.PUBLISH_WIDGET_AND_PAGE_CLICKED;rt(t,{widget_count:e.widgetCount,widget_slugs:e.widgetSlugs})},Mne=e=>{const t=e.action===ig.EXIT?eL.EXIT_CLICKED:eL.BACK_CLICKED;rt(t,{source:e.source})};function iL(){return R.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:R.jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}const Dne=240,Une=e=>e.title||e.widgetName||e.slug;function jne(e){const{snippets:t,selectedIds:n,isLoading:r,isPublishing:o,publishError:i,onToggle:s,onClose:a,onExitWithoutPublishing:l,onExitAndPublish:c}=e,u=t.length>0,d=t.length>1,p=o||r||u&&n.size===0,m=u?c:l;return R.jsxs(FN,{open:!0,maxWidth:"sm",fullWidth:!0,"data-testid":"angie-exit-test-mode-modal",sx:{zIndex:99999},onClose:(h,w)=>{(w==="backdropClick"||w==="escapeKeyDown")&&a()},children:[R.jsxs(qN,{sx:{pl:3,pr:2,py:2,display:"flex",alignItems:"center",gap:1},children:[R.jsx(Zt,{variant:"subtitle1",component:"span",sx:{flex:1},children:"You're exiting Test Mode"}),R.jsx(Yh,{onClick:a,size:"small",disabled:o,"data-testid":"angie-exit-test-mode-modal-btn-close","aria-label":"Close",children:R.jsx(iL,{})})]}),R.jsx(Td,{}),R.jsxs(BN,{sx:{px:3,py:2,display:"flex",flexDirection:"column",gap:2},children:[R.jsx(Zt,{variant:"body1",children:u?R.jsx(R.Fragment,{children:"Make sure you publish what you want to your live site before exiting. Anything not published won't go live, but it's saved and available to use later."}):R.jsx(R.Fragment,{children:"You are about to leave Test Mode and go back to Live Mode. Any non published changes won't appear."})}),r&&R.jsx(Ae,{sx:{display:"flex",justifyContent:"center",py:2},children:R.jsx(Qh,{size:24})}),!r&&u&&R.jsx(Ae,{sx:{py:1,display:"grid",gridTemplateColumns:d?"repeat(2, 1fr)":"1fr",columnGap:3,maxHeight:Dne,overflowY:"auto",opacity:o?.5:1,pointerEvents:o?"none":"auto"},"data-testid":"angie-exit-test-mode-modal-snippets-list",children:t.map(h=>R.jsx(hne,{control:R.jsx(ate,{checked:n.has(h.id),onChange:()=>s(h.id),color:"secondary",size:"small","data-testid":`angie-exit-test-mode-modal-checkbox-${h.id}`}),label:R.jsx(Zt,{variant:"body2",color:"text.secondary",noWrap:!0,children:Une(h)}),sx:{m:0,minWidth:0}},h.id))}),i&&R.jsx(Zt,{variant:"body2",color:"error","data-testid":"angie-exit-test-mode-modal-error",children:i})]}),R.jsx(Td,{}),R.jsxs(zN,{sx:{px:3,py:2},children:[u&&R.jsx(qs,{variant:"outlined",color:"secondary",onClick:l,disabled:o,"data-testid":"angie-exit-test-mode-modal-btn-exit-without-publishing",children:"Exit without publishing"}),R.jsxs(qs,{variant:"contained",color:"primary",onClick:m,disabled:p,"data-testid":"angie-exit-test-mode-modal-btn-exit-and-publish",children:[o&&R.jsx(Qh,{size:14,color:"inherit",sx:{mr:.75}}),o?"Publishing...":u?"Publish selected and exit":"Exit Test Mode"]})]})]})}const Wne=(e,t)=>{const n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n},Fne=(e,t)=>`Failed to publish ${e} of ${t} snippet${t===1?"":"s"}. Please try again.`,zne=7*24*60*60*1e3,Bne=e=>{const t=Date.now()-zne;return e.filter(n=>{const r=Date.parse(n.createdAt);return Number.isFinite(r)&&r>=t})};function Gne(){const[e,t]=P.useState(null),[n,r]=P.useState([]),[o,i]=P.useState(new Set),[s,a]=P.useState(!1),[l,c]=P.useState(!1),[u,d]=P.useState(null),p=P.useRef(e);if(p.current=e,P.useEffect(()=>(window.angieConfirmExitTestMode=f=>new Promise(g=>{t(y=>(y==null||y.resolve(!1),{resolve:g,source:f}))}),()=>{var f;(f=p.current)==null||f.resolve(!1),p.current=null,delete window.angieConfirmExitTestMode}),[]),P.useEffect(()=>{if(!e){r([]),i(new Set),d(null),c(!1);return}let f=!1;return a(!0),d(null),XH().then(g=>{if(f)return;const y=Bne(g);r(y),i(new Set(y.map(_=>_.id)))}).catch(g=>{console.warn("Failed to fetch unpublished snippets:",g),!f&&(r([]),i(new Set),d("Unable to load unpublished snippets. Please try again."))}).finally(()=>{f||a(!1)}),()=>{f=!0}},[e]),!e)return null;const m=(f,g)=>{p.current&&(Mne({action:g,source:p.current.source}),p.current.resolve(f)),t(null)},h=()=>{l||m(!1,ig.BACK)},w=()=>{m(!0,ig.EXIT)},v=async()=>{const f=n.filter(E=>o.has(E.id));if(f.length===0){w();return}c(!0),d(null);const g=oL(f.length),y=await Promise.allSettled(f.map(E=>nP(E.id))),_=y.filter(E=>E.status==="rejected").length;if(y.forEach((E,S)=>{if(E.status==="fulfilled"){const k=f[S];cg({source:"angie",snippetSlug:k.slug,snippetId:k.id,snippetType:k.types[0],publishSource:sg.TEST_MODE_MODAL,interactionId:g})}}),_>0){d(Fne(_,f.length)),c(!1);return}await new Promise(E=>setTimeout(E,0)),m(!0,ig.EXIT)};return R.jsx(jne,{snippets:n,selectedIds:o,isLoading:s,isPublishing:l,publishError:u,onToggle:f=>i(g=>Wne(g,f)),onClose:h,onExitWithoutPublishing:w,onExitAndPublish:v})}const sL="angie-exit-test-mode-modal-root";function Hne(){if(document.getElementById(sL))return;const e=document.createElement("div");e.id=sL,document.body.appendChild(e),hl(e).render(R.jsx(Zh,{colorScheme:"light",palette:"argon-beta",children:R.jsx(Gne,{})}))}async function aL(e){return typeof window.angieConfirmExitTestMode=="function"?window.angieConfirmExitTestMode(e):!0}const qne="https://storage.googleapis.com/ai-website-planner-public-files-prod-elementor/planner-public-static-assets/",Vne="angie_show_test_mode_onboarding",Kne="angie_test_mode_onboarding_complete",Zne="https://elementor.com/help/how-to-use-angie-test-mode-for-elementor-widgets-and-snippets/",Yne=`${qne}test-mode.png`,pS="angie-dev-mode-ui-root",Jne="#ED01EE",Cd={SHOWN:"test_mode_popover_shown",DISMISSED:"test_mode_intro_dismiss_button",GOT_IT_CLICKED:"test_mode_intro_got_it_button",LEARN_MORE_CLICKED:"test_mode_popover_learn_more_clicked"};function Xne({anchorEl:e,isFirstTime:t,onClose:n}){const r=()=>{rt(Cd.DISMISSED),n()},o=()=>{rt(Cd.GOT_IT_CLICKED),n(),t&&uL(Kne)},i=()=>{rt(Cd.LEARN_MORE_CLICKED)};return R.jsx(gne,{open:!0,anchorEl:e,placement:"top",sx:{zIndex:99999},modifiers:[{name:"offset",options:{offset:[72,16]}},{name:"preventOverflow",options:{padding:16}}],children:R.jsxs(Ae,{sx:{width:300,bgcolor:"background.paper",borderRadius:1,boxShadow:"0px 8px 24px rgba(0, 0, 0, 0.15)",position:"relative","&::after":{content:'""',position:"absolute",bottom:-8,left:"50%",transform:"translateX(-50%)",width:0,height:0,borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderTop:"8px solid #fff"}},children:[R.jsxs(Ae,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:2,py:1},children:[R.jsxs(Ae,{sx:{display:"flex",alignItems:"center",gap:1},children:[R.jsx(Zt,{variant:"caption",sx:{color:"text.primary",fontWeight:700,letterSpacing:"0.5px",textTransform:"uppercase"},children:"What is Test Mode?"}),R.jsx(cte,{label:"New",size:"small",color:"default"})]}),R.jsx(Yh,{"aria-label":"Close",onClick:r,size:"small",children:R.jsx(iL,{})})]}),R.jsxs(Ae,{children:[R.jsx(Ae,{sx:{width:"100%",bgcolor:"action.hover",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",mb:2},children:R.jsx("img",{src:Yne,alt:"Test Mode preview",width:"100%",height:"150px"})}),R.jsx(Ae,{sx:{px:2},children:R.jsxs(Zt,{variant:"body2",color:"text.secondary",sx:{mb:.5,lineHeight:1.5},children:["Preview and edit changes in a safe, non-live state. Nothing is pushed to your site until you choose to push it."," ",R.jsx(JN,{href:Zne,target:"_blank",rel:"noopener noreferrer",sx:{color:"#3b82f6 !important",cursor:"pointer",textDecoration:"none","&:hover":{textDecoration:"underline"}},onClick:i,children:"Learn more"})]})})]}),R.jsx(Ae,{sx:{display:"flex",justifyContent:"flex-end",p:1.5},children:R.jsx(qs,{variant:"contained",size:"small",onClick:o,children:"Got it"})})]})})}function Qne(){const e=P.useRef(null),[t,n]=P.useState(!1),r=P.useRef(!1);P.useEffect(()=>{Hne()},[]),P.useEffect(()=>{const s=a=>{var c;const l=document.getElementById("angie-iframe");a.source===(l==null?void 0:l.contentWindow)&&((c=a==null?void 0:a.data)==null?void 0:c.type)===Vne&&(r.current=!0,n(!0),rt(Cd.SHOWN))};return window.addEventListener("message",s),()=>window.removeEventListener("message",s)},[]);const o=async s=>{if(s.preventDefault(),n(!1),await aL(tL.FLOATING_BUTTON))try{await Ys(!1),rt(og.EXITED,{source:"ui",location:"floating_button",exit_reason:"cancel"})}catch(l){console.error("Failed to exit test mode:",l)}},i=s=>{s.preventDefault(),s.stopPropagation(),r.current=!1,n(!t),rt(Cd.SHOWN,{source:"info_icon"})};return R.jsxs(Ae,{ref:e,sx:{position:"fixed",bottom:"20px",left:"50%",transform:"translateX(-50%)",zIndex:1200,"body.angie-sidebar-active &":{left:"calc(var(--angie-sidebar-width, 330px) + (100% - var(--angie-sidebar-width, 330px)) / 2)"},'[dir="rtl"] body.angie-sidebar-active &, body.angie-sidebar-active[dir="rtl"] &':{left:"calc((100% - var(--angie-sidebar-width, 330px)) / 2)"}},children:[R.jsxs(Ae,{style:{display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",backgroundColor:Jne,color:"#ffffff",textDecoration:"none",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.2)",transition:"background-color 0.2s ease"},children:[R.jsx(Ae,{component:"button",onClick:o,sx:{background:"none",border:"none",padding:0,font:"inherit",fontSize:"16px",color:"#ffffff",lineHeight:1,paddingRight:"8px",borderRight:"1px solid rgba(255, 255, 255, 0.5)",cursor:"pointer",transition:"opacity 0.2s ease","&:hover":{opacity:.7,backgroundColor:"transparent"},"&:focus":{outline:"none",boxShadow:"none"},"&:active":{backgroundColor:"transparent"}},children:"✕"}),R.jsx(Ae,{component:"span",children:"Angie Test Mode"}),R.jsx(Ae,{component:"span",onClick:i,"aria-label":"Learn more about Angie Test Mode",sx:{width:"16px",height:"16px",border:"1px solid currentColor",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:"bold",cursor:"pointer",transition:"opacity 0.2s ease","&:hover":{opacity:.7}},children:"i"})]}),t&&e.current&&R.jsx(Xne,{anchorEl:e.current,isFirstTime:r.current,onClose:()=>n(!1)})]})}let Kl=null;function ere(){let e=document.getElementById(pS);return e||(e=document.createElement("div"),e.id=pS,document.body.appendChild(e)),e}function lL(){if(Kl)return;const e=ere();Kl=hl(e),Kl.render(R.jsxs(Zh,{colorScheme:"light",palette:"argon-beta",children:[R.jsx(Pne,{}),R.jsx(Qne,{})]}))}function tre(){var e;Kl&&(Kl.unmount(),Kl=null,(e=document.getElementById(pS))==null||e.remove())}function cL(){return document.getElementById("angie-iframe")||document.querySelector('iframe[src*="angie/"]')}function nre(){const e=cL();if(!(e!=null&&e.src))return null;try{return new URL(e.src).origin}catch(t){return console.warn("Failed to parse iframe URL:",t),null}}function uL(e,t,n){const r=cL(),o=nre();r!=null&&r.contentWindow&&o&&r.contentWindow.postMessage({type:e,payload:{eventName:t,properties:n}},o)}const Hg=class Hg{static getInstance(){return this.instance||(this.instance=new Hg),this.instance}init(){var t;((t=window.angieConfig)!=null&&t.isDevModeEnabled||window.angieDevModeExit)&&lL()}async callDevModeEndpoint(t){await B("/angie/v1/dev-mode","POST",{enabled:t})}async enableDevMode(t=!1){await this.callDevModeEndpoint(!0),window.angieConfig.isDevModeEnabled=!0,t&&lL()}async disableDevMode(){await this.callDevModeEndpoint(!1),window.angieConfig.isDevModeEnabled=!1,tre()}};Ce(Hg,"instance",null);let Zl=Hg;function rre(){var e;return((e=window.angieConfig)==null?void 0:e.isDevModeEnabled)??!1}async function Ys(e,t=!1){e?await Zl.getInstance().enableDevMode(t):await Zl.getInstance().disableDevMode(),uL(ce.ANGIE_TEST_MODE_CHANGED,"test_mode_changed",{enabled:e?"true":"false"}),t||setTimeout(()=>location.reload(),200)}function ore(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Zl.getInstance().init()},{once:!0}):Zl.getInstance().init()}async function dL({artifactId:e,title:t,type:n,files:r,version:o}){vf(r,n),await B("/angie/v1/snippets","POST",{title:t,type:n,artifact_id:e,version:o});const i=encodeURIComponent(e),a=(await B(`/angie/v1/artifacts/${i}/files`,"POST",{files:r,version:o},{customHeaders:{"X-HTTP-Method-Override":"PUT"}})).data;return await ire(a),a}async function ire(e){try{await Ys(!0,!0),e.devModeEnabled=!0}catch(t){const n=t instanceof Error?t.message:String(t);console.warn("[snippet-deploy-service] DevMode enable failed",n),e.devModeEnabled=!1}}async function pL(e){return iu(e)}async function sre(e){var r,o;const t=(r=e.ports)==null?void 0:r[0];if(!t){console.warn("[cloud-library-snippet-bridge] Received request without MessageChannel port");return}const n=(o=e.data)==null?void 0:o.payload;if(!(n!=null&&n.action)){fS(t,{status:"error",payload:"Missing action"});return}try{const i=await are(n);fS(t,{status:"success",payload:i})}catch(i){const s=i instanceof Error?i.message:String(i);fS(t,{status:"error",payload:s})}}async function are(e){switch(e.action){case"list-applied":{const{snippets:t}=await pL();return(t||[]).filter(n=>n.artifactId!==null).map(n=>n.artifactId)}case"list-snippets":{const{snippets:t}=await pL();return(t||[]).map(n=>({id:n.id,title:n.title,artifactId:n.artifactId,types:n.types}))}case"deploy":return dL({artifactId:e.artifactId,title:e.title,type:e.type,files:e.files,version:e.version})}}function fS(e,t){try{e.postMessage(t)}finally{e.close()}}const lre="12px";function cre(e){return{overlay:`${e}-overlay`,container:`${e}-container`,body:`${e}-body`,iframe:`${e}-iframe`,fadeInAnimation:`${e}-fade-in`}}function ure(e,t){const n=cre(e),r=`${e}-styles`;if(document.getElementById(r))return n;const o=t.borderRadius??lre,i=document.createElement("style");return i.id=r,i.textContent=` .${n.overlay} { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(2px); z-index: 999999; display: flex; align-items: center; justify-content: center; animation: ${n.fadeInAnimation} 150ms ease-out; } .${n.container} { position: relative; width: ${t.width}; height: ${t.height}; background: #fff; border-radius: ${o}; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); display: flex; flex-direction: column; overflow: hidden; } .${n.body} { flex: 1; position: relative; overflow: hidden; } .${n.iframe} { width: 100%; height: 100%; border: none; background: transparent; opacity: 0; transition: opacity 200ms ease; } .${n.iframe}.loaded { opacity: 1; } @keyframes ${n.fadeInAnimation} { from { opacity: 0; } to { opacity: 1; } } `,document.head.appendChild(i),n}function dre(){const e=document.documentElement,t=document.body,n=e.style.overflow,r=t.style.overflow;return e.style.overflow="hidden",t.style.overflow="hidden",()=>{e.style.overflow=n,t.style.overflow=r}}function fL(e){const{modalId:t,iframeUrl:n,size:r,iframePermissions:o,buildSkeleton:i,handlers:s}=e,a=ure(t,r);if(document.querySelector(`.${a.overlay}`))return null;const l=document.createElement("div");l.className=a.overlay;const c=document.createElement("div");c.className=a.container;const u=document.createElement("div");u.className=a.body,c.appendChild(u),l.appendChild(c);const d=document.createElement("iframe");d.className=a.iframe,o&&d.setAttribute("allow",o),d.src=n.href;const p=i==null?void 0:i();p&&u.appendChild(p),u.appendChild(d);const m=dre();let h=!1;const w=()=>{var f;h||(h=!0,m(),l.remove(),(f=s==null?void 0:s.onClose)==null||f.call(s))},v=()=>{var f;d.classList.add("loaded"),p==null||p.remove(),(f=s==null?void 0:s.onReady)==null||f.call(s,d)};return l.addEventListener("click",f=>{f.target===l&&w()}),document.body.appendChild(l),{overlay:l,container:c,body:u,iframe:d,close:w,notifyReady:v}}const mL="angie_artifacts_ui",Yl="rgba(0, 0, 0, 0.11)",pre=12,fre=10,ug=24,Tn="angie-cloud-library",hL=`${Tn}-skeleton-styles`,Ue={SKELETON:`${Tn}-skeleton`,SKELETON_HEADER:`${Tn}-skeleton-header`,SKELETON_HEADER_TITLE:`${Tn}-skeleton-header-title`,SKELETON_HEADER_CLOSE:`${Tn}-skeleton-header-close`,SKELETON_TOOLBAR:`${Tn}-skeleton-toolbar`,SKELETON_FILTER:`${Tn}-skeleton-filter`,SKELETON_SEARCH:`${Tn}-skeleton-search`,SKELETON_BODY:`${Tn}-skeleton-body`,SKELETON_HEADER_ROW:`${Tn}-skeleton-header-row`,SKELETON_ROW:`${Tn}-skeleton-row`,SKELETON_CELL:`${Tn}-skeleton-cell`,SKELETON_HEADER_CELL:`${Tn}-skeleton-header-cell`,SKELETON_ACTION:`${Tn}-skeleton-action`,SKELETON_PULSE:`${Tn}-pulse`},mre=8,mS=["70%","85%","50%","65%","55%"],hre="1fr 1fr 1fr 1fr 1fr auto",gre=16,gL=16;function yre(){if(document.getElementById(hL))return;const e=document.createElement("style");e.id=hL,e.textContent=` .${Ue.SKELETON} { position: absolute; inset: 0; background: #fff; display: flex; flex-direction: column; pointer-events: none; } .${Ue.SKELETON_HEADER} { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid #e5e7eb; } .${Ue.SKELETON_HEADER_TITLE} { width: 120px; height: ${fre}px; border-radius: 4px; background: ${Yl}; } .${Ue.SKELETON_HEADER_CLOSE} { width: ${ug}px; height: ${ug}px; border-radius: 4px; background: ${Yl}; } .${Ue.SKELETON_TOOLBAR} { display: flex; gap: 12px; padding: 16px 24px 4px; } .${Ue.SKELETON_FILTER} { width: 120px; height: 36px; border-radius: 4px; background: ${Yl}; } .${Ue.SKELETON_SEARCH} { flex: 1; height: 36px; border-radius: 4px; background: ${Yl}; } .${Ue.SKELETON_BODY} { padding: 0 24px; display: flex; flex-direction: column; } .${Ue.SKELETON_HEADER_ROW}, .${Ue.SKELETON_ROW} { display: grid; grid-template-columns: ${hre}; column-gap: ${gre}px; align-items: center; padding: 8px 0; } .${Ue.SKELETON_HEADER_ROW} { border-bottom: 1px solid #e5e7eb; padding-top: 12px; padding-bottom: 12px; margin-bottom: ${gL}px; } .${Ue.SKELETON_ROW} + .${Ue.SKELETON_ROW} { margin-top: ${gL}px; } .${Ue.SKELETON_CELL} { height: ${pre}px; border-radius: 4px; background: ${Yl}; } .${Ue.SKELETON_HEADER_CELL} { max-width: 60px; width: 60px; } .${Ue.SKELETON_ACTION} { width: ${ug}px; height: ${ug}px; border-radius: 4px; background: ${Yl}; justify-self: end; } .${Ue.SKELETON_HEADER_TITLE}, .${Ue.SKELETON_HEADER_CLOSE}, .${Ue.SKELETON_FILTER}, .${Ue.SKELETON_SEARCH}, .${Ue.SKELETON_CELL}, .${Ue.SKELETON_ACTION} { animation: ${Ue.SKELETON_PULSE} 2s ease-in-out 0.5s infinite; } @keyframes ${Ue.SKELETON_PULSE} { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } } `,document.head.appendChild(e)}function wre(){yre();const e=document.createElement("div");e.className=Ue.SKELETON;const t=document.createElement("div");t.className=Ue.SKELETON_HEADER;const n=document.createElement("div");n.className=Ue.SKELETON_HEADER_TITLE;const r=document.createElement("div");r.className=Ue.SKELETON_HEADER_CLOSE,t.appendChild(n),t.appendChild(r),e.appendChild(t);const o=document.createElement("div");o.className=Ue.SKELETON_TOOLBAR;const i=document.createElement("div");i.className=Ue.SKELETON_FILTER;const s=document.createElement("div");s.className=Ue.SKELETON_SEARCH,o.appendChild(i),o.appendChild(s),e.appendChild(o);const a=document.createElement("div");a.className=Ue.SKELETON_BODY;const l=document.createElement("div");l.className=Ue.SKELETON_HEADER_ROW;for(let u=0;uyL(null)}});n&&yL({iframeOrigin:t.origin,onReady:n.notifyReady,onClose:n.close,onSnippetRequest:sre})}let Jl=null;function yL(e){Jl=e}function bre(e){var t;if(!(!Jl||e.origin!==Jl.iframeOrigin))switch((t=e.data)==null?void 0:t.type){case ce.ANGIE_CLOUD_LIBRARY_READY:Jl.onReady();break;case ce.ANGIE_CLOUD_LIBRARY_CLOSE:Jl.onClose();break;case ce.ANGIE_CLOUD_LIBRARY_SNIPPET_REQUEST:Jl.onSnippetRequest(e);break}}const rn="angie-community-library",wL=`${rn}-skeleton-styles`,Le={SKELETON:`${rn}-skeleton`,SKELETON_HEADER:`${rn}-skeleton-header`,SKELETON_TITLE:`${rn}-skeleton-title`,SKELETON_CLOSE:`${rn}-skeleton-close`,SKELETON_TOOLBAR:`${rn}-skeleton-toolbar`,SKELETON_FILTER:`${rn}-skeleton-filter`,SKELETON_SEARCH:`${rn}-skeleton-search`,SKELETON_BODY:`${rn}-skeleton-body`,SKELETON_SIDEBAR:`${rn}-skeleton-sidebar`,SKELETON_SIDEBAR_ROW:`${rn}-skeleton-sidebar-row`,SKELETON_GRID:`${rn}-skeleton-grid`,SKELETON_CARD:`${rn}-skeleton-card`,SKELETON_CARD_IMAGE:`${rn}-skeleton-card-image`,SKELETON_CARD_TITLE:`${rn}-skeleton-card-title`,SKELETON_CARD_DESC:`${rn}-skeleton-card-desc`,PULSE:`${rn}-pulse`},es="rgba(0, 0, 0, 0.11)",Ere=9,Sre=6;function Tre(){if(document.getElementById(wL))return;const e=document.createElement("style");e.id=wL,e.textContent=` .${Le.SKELETON} { position: absolute; inset: 0; background: #fff; display: flex; flex-direction: column; pointer-events: none; } .${Le.SKELETON_HEADER} { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid #e5e7eb; } .${Le.SKELETON_TITLE} { width: 160px; height: 18px; border-radius: 4px; background: ${es}; } .${Le.SKELETON_CLOSE} { width: 24px; height: 24px; border-radius: 4px; background: ${es}; } .${Le.SKELETON_BODY} { flex: 1; display: flex; min-height: 0; } .${Le.SKELETON_SIDEBAR} { width: 240px; border-right: 1px solid #e5e7eb; padding: 12px; display: flex; flex-direction: column; gap: 8px; } .${Le.SKELETON_SIDEBAR_ROW} { width: 100%; height: 16px; border-radius: 4px; background: ${es}; } .${Le.SKELETON_TOOLBAR} { display: flex; gap: 12px; padding: 16px 24px 4px; } .${Le.SKELETON_FILTER} { width: 120px; height: 36px; border-radius: 4px; background: ${es}; } .${Le.SKELETON_SEARCH} { flex: 1; height: 36px; border-radius: 4px; background: ${es}; } .${Le.SKELETON_GRID} { padding: 12px 24px 24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } .${Le.SKELETON_CARD} { display: flex; flex-direction: column; gap: 8px; } .${Le.SKELETON_CARD_IMAGE} { width: 100%; aspect-ratio: 16 / 10; border-radius: 8px; background: ${es}; } .${Le.SKELETON_CARD_TITLE} { width: 70%; height: 14px; border-radius: 4px; background: ${es}; } .${Le.SKELETON_CARD_DESC} { width: 90%; height: 12px; border-radius: 4px; background: ${es}; } .${Le.SKELETON_TITLE}, .${Le.SKELETON_CLOSE}, .${Le.SKELETON_SIDEBAR_ROW}, .${Le.SKELETON_FILTER}, .${Le.SKELETON_SEARCH}, .${Le.SKELETON_CARD_IMAGE}, .${Le.SKELETON_CARD_TITLE}, .${Le.SKELETON_CARD_DESC} { animation: ${Le.PULSE} 2s ease-in-out 0.5s infinite; } @keyframes ${Le.PULSE} { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } } `,document.head.appendChild(e)}function kre(){Tre();const e=document.createElement("div");e.className=Le.SKELETON;const t=document.createElement("div");t.className=Le.SKELETON_HEADER;const n=document.createElement("div");n.className=Le.SKELETON_TITLE;const r=document.createElement("div");r.className=Le.SKELETON_CLOSE,t.appendChild(n),t.appendChild(r),e.appendChild(t);const o=document.createElement("div");o.className=Le.SKELETON_BODY;const i=document.createElement("div");i.className=Le.SKELETON_SIDEBAR;for(let d=0;d_L(null)}});n&&_L({iframeOrigin:t.origin,onReady:n.notifyReady,onClose:n.close})}let Id=null;function _L(e){Id=e}function Ire(e){var t;if(!(!Id||e.origin!==Id.iframeOrigin))switch((t=e.data)==null?void 0:t.type){case ce.ANGIE_COMMUNITY_LIBRARY_READY:Id.onReady();break;case ce.ANGIE_COMMUNITY_LIBRARY_CLOSE:Id.onClose();break}}const Pre=e=>{const t=document.createElement("textarea");t.value=e,t.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;padding:0;border:0;outline:0;box-shadow:none;background:transparent;",t.setAttribute("readonly",""),document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,99999),document.execCommand("copy")}finally{document.body.removeChild(t)}},Rre=async e=>{var n,r,o,i,s,a,l,c,u,d,p,m,h;if(e.origin==="https://angie.elementor.com")switch(e.data.type){case ce.INIT_CONTEXT_SERVER:const w=e.ports[0],v=SH(),f=new o9(w);v.connect(f),console.log("Context server initialized");break;case ce.ANGIE_ELEMENT_UPDATE_CUSTOM_CSS:const g=e.data.payload.elementId,y=window.elementor.getContainer(g),_=(r=(n=y.settings)==null?void 0:n.attributes)==null?void 0:r.custom_css,E=e.data.payload.custom_css,S=_?`${_} ${E}`:E,k=window.$e.run("document/elements/settings",{container:y,settings:{custom_css:S},options:{external:!0,render:!0}});window.elementorFrontend.elements.$body.resize(),Ye(e.ports[0],{message:`Settings for element with ID "${g}" updated successfully.`,payload:k});break;case ce.ANGIE_ELEMENT_GET_HTML_MARKUP:const C=e.data.payload.containerId,U=((i=(o=window.elementor.getContainer(C).view)==null?void 0:o.el)==null?void 0:i.outerHTML)||"";Ye(e.ports[0],{message:`HTML markup for container with ID "${C}" retrieved successfully.`,payload:U});break;case ce.ANGIE_ELEMENT_GET_CSS:try{const T=e.data.payload.elementId,A=window.elementor.getContainer(T);if(!A){je(e.ports[0],{message:`Container with ID "${T}" not found.`});break}const L=((a=(s=A.settings)==null?void 0:s.attributes)==null?void 0:a.custom_css)||"";Ye(e.ports[0],{message:`CSS for element with ID "${T}" retrieved successfully.`,payload:{elementId:T,customCss:L}})}catch(T){je(e.ports[0],{message:`Error retrieving CSS for element: ${T}`})}break;case ce.ANGIE_ELEMENT_INJECT_CSS:try{const T=e.data.payload.elementId,A=e.data.payload.parsedCss;eI(T,A),Ye(e.ports[0],{message:`Style element with ID "${T}" injected successfully.`})}catch(T){je(e.ports[0],{message:`Error injecting style element: ${T}`})}break;case ce.ANGIE_ELEMENT_REMOVE_CSS:try{const T=e.data.payload.elementId;tI(T),Ye(e.ports[0],{message:`Style element with ID "${T}" removed successfully.`})}catch(T){je(e.ports[0],{message:`Error removing style element: ${T}`})}break;case ce.ANGIE_MEDIA_UPLOAD:await n9(e.ports[0],e.data.payload);break;case ce.ANGIE_SETTINGS_UPDATE:try{const{settings:T}=e.data.payload;console.log("Updating WordPress settings:",T),await B("/wp/v2/settings","POST",T),Ye(e.ports[0],{message:"WordPress settings updated successfully",payload:{settings:T}})}catch(T){console.error("Error updating WordPress settings:",T),je(e.ports[0],{message:`Error updating WordPress settings: ${T}`})}break;case ce.ANGIE_CONTEXT_GET_WEBSITE_CONTEXT:try{const T=await BH();Ye(e.ports[0],{payload:T})}catch{je(e.ports[0],{error:"Failed to get extended website context"})}break;case ce.ANGIE_CONTEXT_GET_ANALYTICS_CONTEXT:try{const T=await t9();Ye(e.ports[0],{payload:T})}catch{je(e.ports[0],{error:"Failed to get analytics context"})}break;case ce.ANGIE_CONTEXT_GET_POST_ID:try{const A=new URLSearchParams(window.location.search).get("post");Ye(e.ports[0],{payload:{postId:A||null}})}catch(T){je(e.ports[0],{message:`Error getting post ID: ${T}`})}break;case ce.ANGIE_ELEMENT_UPDATE_SETTINGS:try{const{id:T,settings:A}=e.data.payload,L=await QC({id:T,settings:A});Ye(e.ports[0],{message:`Settings for element with ID "${T}" updated successfully.`,payload:L})}catch(T){console.error("Error updating element settings:",T),je(e.ports[0],{message:`Error updating element settings: ${T}`})}break;case ce.ANGIE_ELEMENT_GET_ELEMENT_ATTRIBUTES:try{const{id:T}=e.data.payload,A=Z3(T);Ye(e.ports[0],{message:`Settings for element with ID "${T}" retrieved successfully.`,payload:{attributes:A.attributes}})}catch(T){console.error("Error getting element settings:",T),je(e.ports[0],{message:`Error getting element settings: ${T}`})}break;case ce.QUERY_WP_DB:try{console.log("QUERY_WP_DB: dbQueryPayload",e);const{payload:T}=e.data;if(!T){console.error("QUERY_WP_DB: Missing payload in request"),je(e.ports[0],{message:"Missing payload in request"});return}const{endpoint:A,method:L="GET",requestId:j,data:q}=T;if(!A){console.error("QUERY_WP_DB: Missing endpoint in payload"),je(e.ports[0],{message:"Missing endpoint in request"});return}const K=await B(A,L,q);Ye(e.ports[0],{requestId:j,result:K.data})}catch(T){console.error("Error in QUERY_WP_DB:",T);const A=T instanceof Error?T.message:String(T);je(e.ports[0],{message:`Error querying WordPress database: ${A}`})}break;case ce.ANGIE_GET_MEDIA_BLOB:try{const{mediaUrl:T}=e.data.payload;if(console.log("Fetching media blob for URL:",T),!T)throw new Error("Media URL is required");const A=await fetch(T);if(!A.ok)throw new Error(`Failed to fetch image: ${A.status} ${A.statusText}`);const L=await A.blob(),j=await new Promise((q,K)=>{const J=new FileReader;J.onload=()=>{const Z=J.result.split(",")[1];q(Z)},J.onerror=K,J.readAsDataURL(L)});Ye(e.ports[0],{message:"Media blob fetched successfully",payload:{blob:j,contentType:L.type,size:L.size}})}catch(T){console.error("Error fetching media blob:",T),je(e.ports[0],{message:`Error fetching media blob: ${T}`})}break;case ce.ANGIE_WP_UPDATE_POST_FEATURED_IMAGE:try{const{postId:T,postType:A,mediaId:L}=e.data.payload;console.log("Updating post featured image:",{postId:T,postType:A,mediaId:L});const j=await ki(A),K=(await B(`${j}/${T}`,"PUT",{featured_media:L})).data;Ye(e.ports[0],{message:`Featured image updated successfully for ${A} ${T}`,payload:K})}catch(T){console.error("Error updating post featured image:",T),je(e.ports[0],{message:`Error updating post featured image: ${T}`})}break;case ce.ANGIE_GUTENBERG_UPDATE_BLOCK:try{const{blockId:T,attributes:A}=e.data.payload;console.log("Updating Gutenberg block attributes:",{blockId:T,attributes:A});const L=X3(T,A);Ye(e.ports[0],{message:`Gutenberg block "${T}" updated successfully`,payload:L})}catch(T){console.error("Error updating Gutenberg block:",T),je(e.ports[0],{message:`Error updating Gutenberg block: ${T}`})}break;case ce.ANGIE_ZOOM_DISPLAY:try{k3(e.data.payload),Ye(e.ports[0],{success:!0})}catch(T){console.error("Error showing zoom overlay:",T),je(e.ports[0],{message:`Error showing zoom overlay: ${T}`})}break;case ce.ANGIE_MODAL_DISPLAY:try{const{modalType:T,imageUrl:A,elementId:L,...j}=e.data.payload,{imageId:q,imageUrl:K}=e9(L,"",A),J=await r9({modalType:T,imageId:q,imageUrl:K,elementId:L,context:{controlName:"image",elementId:L,elementType:"widget"},...j});if(J.url&&J.id&&L)try{await QC({id:L,settings:{image:{url:J.url,id:J.id||"",source:J.id?"id":"url"}}}),console.log(`✅ Host successfully updated element ${L}`)}catch(z){console.error("Error updating element settings:",z)}Ye(e.ports[0],{message:"Image tools modal triggered successfully",payload:J})}catch(T){console.error("Error triggering image tools modal:",T),je(e.ports[0],{error:T})}break;case ce.ANGIE_LIBRARY_MODAL_OPEN:try{const{modalType:T,source:A}=e.data.payload||{};switch(T){case"community":vL(A);break;case"cloud":hS(A);break;case"prompt":Pv();break}}catch(T){console.error("Error opening library modal:",T),e.ports[0]&&je(e.ports[0],{error:T})}break;case ce.ANGIE_PROMPT_LIBRARY_MODAL:try{const{action:T}=e.data.payload||{};T==="open"&&Pv()}catch(T){console.error("Error opening prompt library modal:",T)}break;case ce.ANGIE_CLOUD_LIBRARY_TOGGLE:try{const{action:T,source:A}=e.data.payload||{};T==="open"&&hS(A)}catch(T){console.error("Error opening cloud library:",T)}break;case ce.ANGIE_CLOUD_LIBRARY_READY:case ce.ANGIE_CLOUD_LIBRARY_CLOSE:case ce.ANGIE_CLOUD_LIBRARY_SNIPPET_REQUEST:bre(e);break;case ce.ANGIE_COMMUNITY_LIBRARY_TOGGLE:try{const{action:T,source:A}=e.data.payload||{};T==="open"&&vL(A)}catch(T){console.error("Error opening community library:",T)}break;case ce.ANGIE_COMMUNITY_LIBRARY_READY:case ce.ANGIE_COMMUNITY_LIBRARY_CLOSE:Ire(e);break;case ce.ANGIE_BRAND_VOICE_MODAL:try{await eP({origin:"https://angie.elementor.com",path:"/brand-voice?source=angie",siteKey:(l=window.angieConfig)==null?void 0:l.siteKey,css:{width:"100%",height:"100%",position:"fixed",bottom:0,right:0,"z-index":999999}}),Ye(e.ports[0],{message:"Brand Voice modal opened successfully",payload:{success:!0}})}catch(T){console.error("Error opening brand voice modal:",T),je(e.ports[0],{message:`Error opening brand voice modal: ${T}`})}break;case ce.ANGIE_DELETE_CHAT_DIALOG:try{await eP({origin:"https://angie.elementor.com",path:"/delete-chat-confirmation",siteKey:(c=window.angieConfig)==null?void 0:c.siteKey,css:{width:"100%",height:"100%",position:"fixed",top:0,left:0,"z-index":999999,"background-color":"rgba(0, 0, 0, 0.5)",display:"flex","align-items":"center","justify-content":"center"}}),Ye(e.ports[0],{message:"Delete chat dialog opened successfully",payload:{success:!0}})}catch(T){console.error("Error opening delete chat dialog:",T),je(e.ports[0],{message:`Error opening delete chat dialog: ${T}`})}break;case ce.GET_SITE_KEY:try{Ye(e.ports[0],{payload:{siteKey:(u=window.angieConfig)==null?void 0:u.siteKey}})}catch(T){je(e.ports[0],{message:`Error getting site key: ${T}`})}break;case ce.ANGIE_NAVIGATE_TO_URL:{const T=((d=e.data.payload)==null?void 0:d.url)??e.data.url;let A=!1,L="";if(T&&typeof T=="string")try{const j=new URL(T,window.location.origin),q=j.origin===window.location.origin,K=j.pathname.startsWith("/wp-admin/");q&&K?(window.location.href=T,A=!0):(L="Navigation blocked: URL validation failed (must be same origin and /wp-admin/ path)",console.error("[Angie] Blocked navigation to untrusted URL:",T))}catch(j){L=`Invalid navigation URL: ${j instanceof Error?j.message:String(j)}`,console.error("[Angie] Invalid navigation URL:",T,j)}else L="Invalid or missing URL";e.ports[0]&&(A?Ye(e.ports[0],{payload:{navigated:A}}):je(e.ports[0],{message:L}));break}case ce.ANGIE_TEST_MODE_GET_STATUS:try{const T=rre();Ye(e.ports[0],{payload:{enabled:T}})}catch(T){const A=T instanceof Error?T.message:String(T);je(e.ports[0],{message:`Error getting test mode status: ${A}`})}break;case ce.ANGIE_TEST_MODE_SET:try{const T=((p=e.data.payload)==null?void 0:p.enabled)===!0,A=((m=e.data.payload)==null?void 0:m.skipReload)===!0;if(!T&&!await aL(tL.CHAT_INTERFACE)){Ye(e.ports[0],{payload:{enabled:!0}});break}await Ys(T,A),Ye(e.ports[0],{payload:{enabled:T}})}catch(T){const A=T instanceof Error?T.message:String(T);je(e.ports[0],{message:`Error setting test mode: ${A}`})}break;case ce.GET_EXTERNAL_HEADERS:try{if(!((h=window.angieConfig)!=null&&h.isElementorOneConnected)){Ye(e.ports[0],{});break}const T=await U3();Ye(e.ports[0],{"X-Elementor-One-Token":T==null?void 0:T.access_token})}catch(T){console.error("Failed to get token from WordPress:",T);const A=T instanceof Error?T.message:"Unknown error occurred";je(e.ports[0],{message:A})}break;case ce.STUDIO_UI_SESSION_START:case ce.STUDIO_UI_STATE_UPDATE:case ce.STUDIO_UI_SESSION_END:await z3(e.data.type,e.ports[0],e.data.payload);break;case ce.ANGIE_ARTIFACT_UPDATE_WP_FILES:{try{const{artifactId:T,files:A,version:L}=e.data.payload||{};if(typeof T!="string"||!T||!Array.isArray(A)){je(e.ports[0],{message:"Invalid payload: artifactId and files are required"});break}const j=typeof L=="number"&&Number.isInteger(L)&&L>0?L:void 0,{data:q}=await tv({artifactId:T,files:A,version:j});lg({source:"revisions",snippetSlug:(q==null?void 0:q.slug)||"",snippetId:typeof(q==null?void 0:q.post_id)=="number"?q.post_id:void 0,isOverwrite:!0,artifactId:T}),Ye(e.ports[0],{payload:q})}catch(T){const A=T instanceof Error?T.message:String(T);je(e.ports[0],{message:`Error updating artifact files on WP: ${A}`})}break}case ce.ANGIE_SUPER_ADMIN_OPT_IN:try{await B("/angie/v1/super-admin/opt-in","POST"),Ye(e.ports[0],{message:"Super-admin opt-in acknowledged",payload:{enabled:!0}})}catch(T){console.error("Error handling super-admin opt-in:",T),je(e.ports[0],{message:`Error handling super-admin opt-in: ${T}`})}break;case ce.ANGIE_CLIPBOARD_WRITE:{try{const{text:T}=e.data.payload||{};if(typeof T!="string"){e.ports[0]&&je(e.ports[0],{message:"Invalid payload: text must be a string"});break}const A=Pre(T);e.ports[0]&&(A?Ye(e.ports[0],{payload:{success:!0}}):je(e.ports[0],{message:"Copy command failed"}))}catch(T){e.ports[0]&&je(e.ports[0],{message:`Error copying to clipboard: ${T}`})}break}}},Are=()=>{window.addEventListener("message",async e=>{try{await Rre(e)}catch(t){console.error("Error handling style element message:",t),e.ports&&e.ports[0]&&je(e.ports[0],t)}})};function bL(){const e=document.querySelector(".angie-loading-state");e&&e.remove()}function $re(e){e.waitForReady().then(()=>{bL()}).catch(t=>{console.error("[Angie] Error waiting for Angie to be ready:",t),bL()})}const Ore=` .angie-ai-button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; color: #C00BB9; text-decoration: none; border-radius: 3px; font-size: 13px; font-weight: 500; line-height: 16px; transition: all 0.1s ease; border: 1px solid #C00BB9; cursor: pointer; white-space: nowrap; background: #fff; max-height: 30px; box-shadow: none; width: auto; justify-content: flex-start; box-sizing: border-box; } .angie-ai-button.full-width { width: 100%; } .angie-ai-button:hover { color: #A00999; border-color: #A00999; text-decoration: none; background: #fafafa; } .angie-ai-button:focus { box-shadow: 0 0 0 1.5px #007cba; outline: 2px solid transparent; } .angie-ai-button-icon { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; } /* Secondary variant */ .angie-ai-button.secondary { background: transparent; border: 1px solid transparent; padding: 5px 9px; min-height: auto; } .angie-ai-button.secondary:hover { background: rgba(0, 0, 0, 0.05); border: 1px solid transparent; } `;function Nre(e,t=document){const n=t.createElement("a");n.id=e.id,n.className=`angie-ai-button ${e.className||""} ${e.variant||""}`.trim(),n.href="#",n.setAttribute("aria-label",e.text),n.setAttribute("title",e.text),n.setAttribute("role","button");const r=e.icon;return n.innerHTML=r+e.text,n}function Lre(e=document){const t=e.createElement("style");return t.textContent=Ore,e.head.appendChild(t),t}const Wr={BUTTON_ID:"angie-gutenberg-toolbar-button",BUTTON_TEXT:"Angie",INSERTION_POINT_SELECTOR:".editor-document-tools__left",POLL_INTERVAL_MS:500,POLL_MAX_ATTEMPTS:50,ICON_SVG:` `,STYLES:` .angie-ai-button.angie-gutenberg-toolbar { background: #fff; border-color: #1e1e1e; color: #1e1e1e; max-height: 36px; margin-inline-start: 8px; } .angie-ai-button.angie-gutenberg-toolbar:hover { background: #fafafa; border-color: #1e1e1e; color: #1e1e1e; } `};function Mre(e){return e.querySelector(Wr.INSERTION_POINT_SELECTOR)}function Dre(e){var d;const t=(e==null?void 0:e.windowObj)??window,n=(e==null?void 0:e.documentObj)??document;if(t._angieGutenbergToolbarInjected)return()=>{};t._angieGutenbergToolbarInjected=!0;const r=n.createElement("style");r.textContent=Wr.STYLES,n.head.appendChild(r),Lre(n);let o=null;function i(p){p.preventDefault(),p.stopPropagation();const m=t;typeof m.toggleAngieSidebar=="function"&&m.toggleAngieSidebar()}function s(){if(n.getElementById(Wr.BUTTON_ID))return;const p=Mre(n);if(!p||!p.parentNode)return;const m=Nre({id:Wr.BUTTON_ID,text:Wr.BUTTON_TEXT,className:"angie-gutenberg-toolbar",icon:Wr.ICON_SVG},n);m.addEventListener("click",i),p.parentNode.insertBefore(m,p.nextSibling)}function a(){setTimeout(s,1)}const l=t.wp;(d=l==null?void 0:l.data)!=null&&d.subscribe&&(o=l.data.subscribe(a));let c=0;const u=()=>{c++,s(),!n.getElementById(Wr.BUTTON_ID)&&c{o==null||o(),o=null;const p=n.getElementById(Wr.BUTTON_ID);p==null||p.remove(),r.remove(),delete t._angieGutenbergToolbarInjected}}function Ure(e=Wr.POLL_MAX_ATTEMPTS){return new Promise(t=>{let n=0;const r=()=>{if(V3()){t(!0);return}n++,n{FI("/angie/mcp-gateway",{isStudioOpen:e,isInnerPage:!e,isOpen:!0,source:"mcp-gateway-button"})},Wre=async()=>{window.location.hash==="#angie-mcp-gateway"&&(await new jI().waitForReady(),EL({isStudio:!1})),window.addEventListener("hashchange",()=>{window.location.hash==="#angie-mcp-gateway"&&EL({isStudio:!1})})},Fre=()=>typeof window>"u"?!1:"userAgentData"in navigator&&navigator.userAgentData?navigator.userAgentData.platform==="macOS":/mac/i.test(navigator.userAgent),gS="angie_wp_sidebar_user_intent",yS="open",zre="folded",SL="folded";function Bre(e,t){const n=t.state;if(nu()!==Ma){qre();return}Gre(n)}function Gre(e){sessionStorage.setItem(gS,e)}function Hre(){return sessionStorage.getItem(gS)}function qre(){sessionStorage.removeItem(gS)}function Vre(){return window.getUserSetting("mfold")==="f"?zre:yS}function TL(){document.body.classList.add(SL)}function kL(){document.body.classList.remove(SL)}function xL(){nu()===Ma?Hre()===yS?kL():TL():Vre()===yS?kL():TL()}async function Kre(){await mf(),xL();const e=window.jQuery(document);e.on("wp-collapse-menu",Bre),e.on("angieSidebarToggle",xL)}const Zre="rgba(0, 0, 0, 0.87)",Yre="#EB8EFB",Pd={container:{marginTop:"24px"},list:{display:"flex",flexWrap:"wrap",gap:"12px",marginBottom:"16px"},button:{base:` background: transparent; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 8px; padding: 6px 12px; font-size: 13px; color: rgba(0, 0, 0, 0.87); cursor: pointer; transition: all 0.2s ease; font-family: Roboto, sans-serif; font-weight: 400; line-height: 20px; white-space: nowrap; position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; outline: 0; text-decoration: none; -webkit-tap-highlight-color: transparent; `,hover:{boxShadow:"0 4px 8px 0 rgba(0, 0, 0, 0.08)",gradient:"linear-gradient(92deg, #4F75FF 6.65%, #8480FF 34.39%, #EB8EFB 99.52%)"}}},Jre=[{display:"What can Angie do?",prompt:"What can Angie do?",color:Yre},{display:"Create survey widget",prompt:"Build an Elementor widget for a survey. It should allow adding any number of questions and multiple choice answers directly in the Elementor editor. Each answer should have an option to assign a score or tag, and at the end different redirect URLs can be set based on the final result. Include full design controls in the editor for colors, border radius, button styles, and font. Everything should preview live. Add a progress bar and smooth transitions between questions."},{display:"Find unused media",prompt:"Using code, scan my media library for images and files that aren't used anywhere on my site, add a button to view the list, and let me select which ones to safely delete"},{display:"Create Image accordion widget",prompt:"Create an image accordion Elementor widget where each image expands on hover or click, with overlay text controls and animation timing settings"},{display:"Customize Admin dashboard",prompt:`Add a custom dashboard widget that shows [e.g., "today's sales summary" or "pending reviews" or "site health checklist"]`},{display:"Create ZigZag widget",prompt:"Create a Zigzag widget for Elementor using a Repeater, where each item displays an image + content block (heading, text, and optional button). The layout should automatically alternate per row: first item image left/content right, second item image right/content left, and so on. Each repeater section should include controls for image, heading, description, and button settings (text + link), with responsive behavior to stack nicely on mobile."},{display:"Create circular cursor follower",prompt:`Add an interactive cursor effect to my WordPress site with admin controls: Create a circular cursor follower that inverts or changes the color of page content underneath it as the mouse moves. The circle should: Follow the cursor smoothly Have a customizable size (around 50-100px diameter) Apply a blend mode effect (like difference or exclusion) to invert colors of text/images beneath it Work across the entire page Be performant and not cause lag Add a WordPress admin settings page: Create a new menu item in the WordPress admin sidebar called "Cursor Effect" or similar Include controls to adjust: Circle size (slider or number input) Circle color Blend mode options (difference, exclusion, multiply, etc.) Enable/disable the effect Animation speed/smoothness Optional: Circle border thickness and style Save settings to the WordPress database Apply the saved settings to the frontend cursor effect in real-time `}];function Xre(e,t){Object.assign(e.style,t)}function wS(e,t,n){const r=document.createElement(e);return t&&(r.className=t),n&&Xre(r,n),r}function Qre(e){const t=zn();if(!(t!=null&&t.contentWindow)){console.error("Angie iframe not found");return}try{const n=t.src?new URL(t.src).origin:"*";t.contentWindow.postMessage({type:ut.SDK_TRIGGER_ANGIE,payload:{prompt:e.prompt,context:{source:"quick-suggestions",timestamp:new Date().toISOString()}}},n)}catch(n){console.error("Error sending suggestion to Angie:",n)}}function eoe(e){const t=wS("button","angie-suggestion-chip");t.style.cssText=Pd.button.base,t.textContent=e.display;const n=e.color??Zre;return t.style.color=n,t.addEventListener("mouseenter",function(){this.style.boxShadow=Pd.button.hover.boxShadow,this.style.background=Pd.button.hover.gradient,this.style.webkitBackgroundClip="text",this.style.webkitTextFillColor="transparent",this.style.backgroundClip="text"}),t.addEventListener("mouseleave",function(){this.style.boxShadow="none",this.style.background="transparent",this.style.webkitBackgroundClip="initial",this.style.webkitTextFillColor="initial",this.style.backgroundClip="initial",this.style.color=n}),t.addEventListener("click",function(r){r.preventDefault(),Qre(e)}),t}function toe(){const e=wS("div","angie-quick-suggestions",Pd.container),t=wS("div",void 0,Pd.list);return e.appendChild(t),Jre.forEach(n=>{t.appendChild(eoe(n))}),e}function CL(){if(!window.location.href.includes("page=angie-app"))return;const t=document.getElementById("angie-app-start");if(!t||t.querySelector(".angie-quick-suggestions"))return;const n=t.querySelector("p");if(n){const r=toe();n.insertAdjacentElement("afterend",r)}}function noe(){document.readyState==="complete"?IL():window.addEventListener("load",IL)}function IL(){CL();const e=document.getElementById("wpbody")||document.body,t=new MutationObserver(CL);e&&t.observe(e,{childList:!0,subtree:!0})}const roe=[{title:"Write from research",name:"write-from-research",description:"Search for the top 3 ranking articles for the keyword '[Keyword]'. Identify the specific sub-topics or data points they are missing, and write a 2,000-word deep-dive post that includes those missing elements to outrank them."},{title:"Generate excerpts",name:"generate-excerpts",description:"Automatically create and add excerpts to all posts that don't have one, using SEO best practices"},{title:"Add reading time",name:"add-reading-time",description:'Add a custom PHP function to the site that calculates the estimated reading time based on word count and automatically injects an "X min read" badge at the top of every post.'},{title:"Reorganize posts",name:"reorganize-posts",description:"Analyze all my posts and suggest a better categories and tags structure based on my content themes. Show me the recommended changes before applying them so I can approve."},{title:"Show featured images",name:"show-featured-images",description:"Add a featured image thumbnail column at the end of the posts list and enable quick editing to upload or select featured images without opening the full editor"}],ooe=[{title:"Create a landing page",name:"create-landing-page",description:"Create a landing page for [product / campaign] using Gutenberg block editor"},{title:"Duplicate pages",name:"duplicate-pages",description:'Using code, add a "Duplicate" button to the Pages list so I can quickly clone any item with one click'},{title:"Add meta field",name:"add-meta-field",description:"Add a custom meta description field to all posts and pages that controls what text appears in Google search results and social media previews. Configure the featured image to automatically be used as the preview image for social sharing on Facebook, WhatsApp, and other platforms."},{title:"Delete unused pages",name:"delete-unused-pages",description:"Delete all pages with status [draft/pending] that haven't been modified since [date]"},{title:"Fix slugs",name:"fix-slugs",description:"Scan all my pages for problematic URL slugs (too long, special characters, only numbers, non-SEO friendly) and suggest improvements"},{title:"Change page parent",name:"change-page-parent",description:"Make [page title] a child page of [parent page title]"}],ts=b().describe("WordPress post type. Common types: post, page, attachment, revision, nav_menu_item, wp_block, wp_template, wp_template_part, wp_navigation, product (WooCommerce), shop_order (WooCommerce), shop_coupon (WooCommerce), product_variation (WooCommerce). Can be any custom post type too."),PL=fe({id:M().optional().describe("Unique identifier"),title:b().optional().describe("Post title"),content:b().optional().describe(`Post content. ${YI}`),excerpt:b().optional().describe(`Post excerpt. ${ou}`),status:ve(["publish","future","draft","pending","private","trash"]).optional().default("draft").describe('A named status for the post. Use "future" for scheduled posts (requires future date), "publish" for immediate publication, "draft" for unpublished content. Valid values: publish, future, draft, pending, private, trash.'),type:ts.optional().default("post").describe("Post type (post, page, custom post type). Use the postType parameter in the tool instead to determine the correct endpoint."),author:M().optional().describe("Author ID"),featured_media:M().optional().describe("Featured image/media ID"),categories:te(M()).optional().describe("Category IDs to assign"),tags:te(M()).optional().describe("Tag IDs to assign"),date:b().optional().describe(`The date the post was published, in the site's timezone (ISO8601 format). This is the PUBLICATION DATE, not the last modified date. For scheduling: if this field has a future date, you can set status to "future" to schedule the post. If omitted, WordPress uses the existing date. Current/past dates with status "publish" will publish immediately.`),slug:b().optional().describe("URL slug (used in permalinks)"),format:ve(["standard","aside","chat","gallery","link","image","quote","status","video","audio"]).optional().describe("Post format for theme styling"),sticky:Y().optional().describe("Pin to top of blog"),password:b().optional().describe("Password to protect content"),parent:M().optional().describe("The ID for the parent of the post (for hierarchical post types like pages)"),menu_order:M().optional().describe("The order of the post in relation to other posts"),meta:sn(Hr()).optional().describe("Custom meta fields"),comment_status:ve(["open","closed"]).optional().describe("Allow comments"),ping_status:ve(["open","closed"]).optional().describe("Allow pingbacks/trackbacks"),template:b().optional().describe("The theme to use to display the post")}).describe("WordPress post data schema"),ioe=fe({blogname:b().optional().describe(`Site title. ${ru}`),blogdescription:b().optional().describe(`Site tagline. ${ru}`),siteurl:b().optional().describe("Site URL"),admin_email:b().optional().describe("Admin email address"),timezone_string:b().optional().describe('Timezone string (e.g., "Europe/Rome")'),date_format:b().optional().describe("Date format"),time_format:b().optional().describe("Time format"),start_of_week:ie([b(),M()]).optional().describe("Day to start the week (0=Sunday, 1=Monday, etc.)"),WPLANG:b().optional().describe('WordPress locale code in format language_COUNTRY (e.g., "fr_FR", "de_DE", "es_ES"). Use "" or "en_US" for English (US).'),use_smilies:ie([b(),Y()]).optional().describe("Whether to convert emoticons to graphics"),default_category:ie([b(),M()]).optional().describe("Default post category ID"),default_post_format:b().optional().describe("Default post format"),default_pingback_flag:ie([b(),Y()]).optional().describe("Attempt to notify any blogs linked to from the post"),ping_sites:b().optional().describe("Update services to ping when publishing new content (URLs separated by newlines)"),posts_per_page:ie([b(),M()]).optional().describe("Blog pages show at most this many posts"),posts_per_rss:ie([b(),M()]).optional().describe("Syndication feeds show the most recent posts"),rss_use_excerpt:ie([b(),Y()]).optional().describe("For each post in a feed, include full text or excerpt"),show_on_front:b().optional().describe('Homepage display type: "posts" shows latest blog posts (for blogs), "page" shows a static page (for business sites)'),page_on_front:ie([b(),M()]).optional().describe('Page ID to use as homepage when show_on_front is "page". Creates a static homepage instead of showing blog posts'),page_for_posts:ie([b(),M()]).optional().describe("Page ID that displays the blog posts index when using a static homepage"),blog_public:ie([b(),Y()]).optional().describe('Search engine visibility: "1" allows search engines to index site, "0" discourages them'),default_ping_status:b().optional().describe('Default ping status for new posts ("open" or "closed")'),default_comment_status:b().optional().describe('Default comment status for new posts ("open" or "closed")'),comment_registration:ie([b(),Y()]).optional().describe("Users must be registered and logged in to comment"),require_name_email:ie([b(),Y()]).optional().describe("Comment author must fill out name and email"),comment_previously_approved:ie([b(),Y()]).optional().describe("Comment author must have a previously approved comment"),close_comments_for_old_posts:ie([b(),Y()]).optional().describe("Automatically close comments on posts older than X days"),close_comments_days_old:ie([b(),M()]).optional().describe("Days before comments are closed on old posts"),thread_comments:ie([b(),Y()]).optional().describe("Enable threaded (nested) comments"),thread_comments_depth:ie([b(),M()]).optional().describe("Maximum depth for threaded comments"),page_comments:ie([b(),Y()]).optional().describe("Break comments into pages"),comments_per_page:ie([b(),M()]).optional().describe("Number of top level comments per page"),default_comments_page:b().optional().describe('Comments page displayed by default ("newest" or "oldest")'),comment_order:b().optional().describe('Comments order: "asc" (older first) or "desc" (newer first)'),comments_notify:ie([b(),Y()]).optional().describe("Email me when someone posts a comment"),moderation_notify:ie([b(),Y()]).optional().describe("Email me when a comment is held for moderation"),comment_moderation:ie([b(),Y()]).optional().describe("Comment must be manually approved before appearing"),comment_max_links:ie([b(),M()]).optional().describe("Hold comment for moderation if it contains this many links"),show_avatars:ie([b(),Y()]).optional().describe("Show avatars in comments"),avatar_rating:b().optional().describe("Maximum avatar rating (G, PG, R, X)"),avatar_default:b().optional().describe("Default avatar type (mystery, blank, gravatar_default, identicon, wavatar, monsterid, retro, robohash)"),thumbnail_size_w:ie([b(),M()]).optional().describe("Thumbnail width in pixels"),thumbnail_size_h:ie([b(),M()]).optional().describe("Thumbnail height in pixels"),thumbnail_crop:ie([b(),Y()]).optional().describe("Crop thumbnail to exact dimensions"),medium_size_w:ie([b(),M()]).optional().describe("Medium image width in pixels"),medium_size_h:ie([b(),M()]).optional().describe("Medium image height in pixels"),large_size_w:ie([b(),M()]).optional().describe("Large image width in pixels"),large_size_h:ie([b(),M()]).optional().describe("Large image height in pixels"),uploads_use_yearmonth_folders:ie([b(),Y()]).optional().describe("Organize uploads into year/month folders"),permalink_structure:b().optional().describe("Custom permalink structure (e.g., /%postname%/)"),category_base:b().optional().describe("Category URL base"),tag_base:b().optional().describe("Tag URL base"),users_can_register:ie([b(),Y()]).optional().describe("Anyone can register"),default_role:b().optional().describe("New user default role (subscriber, contributor, author, editor, administrator)"),wp_page_for_privacy_policy:ie([b(),M()]).optional().describe("Privacy policy page ID"),site_logo:ie([b(),M()]).optional().describe("Site logo media ID"),site_icon:ie([b(),M()]).optional().describe("Site icon (favicon) media ID")}).describe("WordPress site settings object"),Rd=ve(["view","embed","edit"]).optional().describe("Scope under which the request is made; determines fields present in response"),Ad=fe({page:M().optional().describe("Current page of the collection"),per_page:M().optional().describe("Maximum number of items to be returned in result set"),offset:M().optional().describe("Offset the result set by a specific number of items")}),dg=fe({order:ve(["asc","desc"]).optional().describe("Order sort attribute ascending or descending")}),$d=fe({search:b().optional().describe("Limit results to those matching a string")}),pg=fe({_fields:ie([b(),te(b())]).optional().describe("Limit response to specific fields, for instance: _fields=id,title,content. When not asked for Content explicitly, use this to filter out content and save bandwidth. Can be a comma-separated string or array of field names")}),soe=fe({context:Rd,...Ad.shape,...$d.shape,...dg.shape,...pg.shape,after:b().optional().describe("Limit response to posts published after a given ISO8601 compliant date"),modified_after:b().optional().describe("Limit response to posts modified after a given ISO8601 compliant date"),author:ie([M(),te(M())]).optional().describe("Limit result set to posts assigned to specific authors"),author_exclude:ie([M(),te(M())]).optional().describe("Ensure result set excludes posts assigned to specific authors"),before:b().optional().describe("Limit response to posts published before a given ISO8601 compliant date"),modified_before:b().optional().describe("Limit response to posts modified before a given ISO8601 compliant date"),exclude:ie([M(),te(M())]).optional().describe("Ensure result set excludes specific IDs"),include:ie([M(),te(M())]).optional().describe("Limit result set to specific IDs"),orderby:ve(["author","date","id","include","modified","parent","relevance","slug","include_slugs","title"]).optional().describe("Sort collection by post attribute"),search_columns:te(b()).optional().describe("Array of column names to be searched"),slug:ie([b(),te(b())]).optional().describe("Limit result set to posts with one or more specific slugs"),status:ie([ve(["any","publish","future","draft","pending","private","trash","auto-draft","inherit"]),b()]).optional().describe('Post status filter - defaults to "publish" only. Use "any" for all content including drafts/private, "publish,draft" for specific combinations, or individual statuses like "draft".'),tax_relation:ve(["AND","OR"]).optional().describe("Limit result set based on relationship between multiple taxonomies"),categories:ie([M(),te(M())]).optional().describe("Limit result set to items with specific terms assigned in the categories taxonomy"),categories_exclude:ie([M(),te(M())]).optional().describe("Limit result set to items except those with specific terms assigned in the categories taxonomy"),tags:ie([M(),te(M())]).optional().describe("Limit result set to items with specific terms assigned in the tags taxonomy"),tags_exclude:ie([M(),te(M())]).optional().describe("Limit result set to items except those with specific terms assigned in the tags taxonomy"),sticky:Y().optional().describe("Limit result set to items that are sticky")}),vS=fe({context:Rd,...Ad.shape,...$d.shape,...dg.shape,...pg.shape,exclude:ie([M(),te(M())]).optional().describe("Ensure result set excludes specific IDs"),include:ie([M(),te(M())]).optional().describe("Limit result set to specific IDs"),orderby:ve(["id","include","name","slug","term_group","description","count"]).optional().describe("Sort collection by term attribute"),hide_empty:Y().optional().describe("Whether to hide terms not assigned to any posts"),post:M().optional().describe("Limit result set to terms assigned to a specific post"),slug:ie([b(),te(b())]).optional().describe("Limit result set to terms with one or more specific slugs")});fe({context:Rd,...Ad.shape,...$d.shape,...dg.shape,...pg.shape,exclude:ie([M(),te(M())]).optional().describe("Ensure result set excludes specific IDs"),include:ie([M(),te(M())]).optional().describe("Limit result set to specific IDs"),orderby:ve(["id","include","name","slug","term_group","description","count"]).optional().describe("Sort collection by term attribute"),hide_empty:Y().optional().describe("Whether to hide terms not assigned to any posts"),post:M().optional().describe("Limit result set to terms assigned to a specific post"),slug:ie([b(),te(b())]).optional().describe("Limit result set to terms with one or more specific slugs")});const Xl=b().describe("WordPress taxonomy type. Common types: category, post_tag, product_cat (WooCommerce), product_tag (WooCommerce), product_type (WooCommerce). Can be any custom taxonomy too."),aoe=fe({context:Rd,...Ad.shape,...$d.shape,...dg.shape,...pg.shape,after:b().optional().describe("Limit response to comments published after a given ISO8601 compliant date"),author:ie([M(),te(M())]).optional().describe("Filter by author ID"),author_exclude:ie([M(),te(M())]).optional().describe("Ensure result set excludes comments assigned to specific user IDs"),author_email:b().optional().describe("Limit result set to that from a specific author email"),before:b().optional().describe("Limit response to comments published before a given ISO8601 compliant date"),exclude:ie([M(),te(M())]).optional().describe("Ensure result set excludes specific IDs"),include:ie([M(),te(M())]).optional().describe("Limit result set to specific IDs"),orderby:ve(["date","date_gmt","id","include","post","parent","type"]).optional().describe("Order comments by"),parent:ie([M(),te(M())]).optional().describe("Limit result set to comments of specific parent IDs"),parent_exclude:ie([M(),te(M())]).optional().describe("Ensure result set excludes specific parent IDs"),post:ie([M(),te(M())]).optional().describe("Limit result set to comments assigned to specific post IDs"),status:b().optional().describe("Limit result set to comments assigned a specific status"),type:b().optional().describe("Limit result set to comments assigned a specific type"),password:b().optional().describe("Password for post if it is password protected")}),loe=fe({context:Rd,...Ad.shape,...$d.shape,status:ie([ve(["active","inactive"]),te(ve(["active","inactive"]))]).optional().describe("Limit result set to themes assigned one or more statuses")}),ns=(e,t)=>{if(!e||e.trim()==="")throw new Error(`LLM Instructions: ${t} changes require user confirmation. You MUST provide a confirmationMessage parameter explaining what will be changed and its impact.`)},_S="wp-post-meta-schema",Ql="wp://"+_S;function RL(){var e,t;return(t=(e=window.angieConfig)==null?void 0:e.postTypesNames)!=null&&t.length?window.angieConfig.postTypesNames:["post","page"]}function AL(e,t){e.resource(_S,new Xr(`${Ql}/{postType}`,{list:async()=>({resources:t.map(n=>({uri:`${Ql}/${n}`,name:`${_S}-${n}`,title:`WP Post Meta Schema (${n})`,description:`Post meta schema for ${n}. Dynamically discovers ALL available fields including WordPress core fields and fields added by installed plugins (Yoast SEO, ACF, WooCommerce, Elementor, etc.)`,mimeType:"application/json"}))})}),{title:"WP Post Meta Schema",description:"Complete post field schema for a specific post type. Dynamically discovers ALL available fields including WordPress core fields (title, status, slug, date, author, categories, tags, etc.) and fields added by installed plugins (Yoast SEO, ACF, WooCommerce, Elementor, and any other plugins). Returns field types, descriptions, and metadata for each field."},async(n,r)=>{console.log(`[Post Meta Schema] Resource handler called with URI: ${n}, variables:`,r);let o=Array.isArray(r.postType)?r.postType[0]:r.postType;o=decodeURIComponent(o),o.includes("{")&&o.includes("}")&&(o=o.replace(/[{}]/g,""));const i=await JC(o);return{contents:[{uri:n.toString(),mimeType:"application/json",text:JSON.stringify(i,null,2)}]}})}const ec={POST_CONTENT:"Add Your Content Here",POST_TITLE:"Untitled",POST_STATUS:"draft"},$L={DRAFT:"draft",PUBLISH:"publish",PENDING:"pending",PRIVATE:"private"};function Od(e,t,n){if(!e||!e.id)throw new Error(`${t} ${n} failed: Invalid response`)}async function OL(e,t,n,r=["not_found","invalid"]){try{throw await B(`${e}/${t}`,"GET"),new Error(`${n} deletion failed: Resource still exists`)}catch(o){const i=o.message;if(r.some(a=>i.includes(a)))return;throw o}}async function coe(e,t){const r=(await B(`${t}/${e}`,"GET")).data;if(!r||!r.id)throw new Error(`Post verification failed: Post ${e} not found after creation`)}async function uoe(e){const n=(await B(`/wp/v2/users/${e}`,"GET")).data;if(!n||!n.id)throw new Error(`User verification failed: User ${e} not found after creation`)}async function doe(e){const n=(await B("/angie/v1/wp-options?options=site_logo","GET")).data;if(!n||n.site_logo!==e)throw new Error(`Site logo verification failed: Expected media ID ${e} but got ${n==null?void 0:n.site_logo}`)}const poe=["excerpt","parent"],foe=["meta","acf"];function moe(e,t,n,r){return!t&&poe.includes(e)?!0:n!=="create"?!1:e==="content"&&(!t||t===ec.POST_CONTENT)||foe.includes(e)&&r==="elementor_library"||Array.isArray(t)&&t.length===0?!0:typeof t=="object"&&Object.keys(t??{}).length===0}function hoe(e,t,n,r){if(r.includes(e)){const o=(n==null?void 0:n.raw)||(n==null?void 0:n.rendered)||n;if(t){if(!o)return`Field "${e}": expected content but got none`}else if(o)return`Field "${e}": expected no content but got "${o}"`;return null}if(Array.isArray(t)){const o=n;return JSON.stringify(t.sort())!==JSON.stringify(o==null?void 0:o.sort())?`Field "${e}": expected [${t.join(", ")}], got [${(o==null?void 0:o.join(", "))||"undefined"}]`:null}return typeof t=="object"?JSON.stringify(t)!==JSON.stringify(n)?`Field "${e}": object mismatch`:null:n!==t?`Field "${e}": expected "${t}", got "${n}"`:null}function NL(e,t,n,r,o="update"){const i=[],s=["title","content","excerpt","date"];for(const[a,l]of Object.entries(e)){if(moe(a,l,o,n))continue;const c=hoe(a,l,t[a],s);c&&i.push(c)}if(i.length>0)throw new Error(`Post validation failed for ${n} ${r}: ${i.join(` `)}`)}function goe(){const e=new mt({name:"wp-posts-server",version:"1.0.0",title:"WP Posts"},{instructions:`## WordPress Posts & Pages Management ### Capabilities: **Content Creation & Management:** - Create and manage posts, pages, and custom post types - Write and edit post/page content - Manage excerpts and content summaries - Plan and schedule content publication - Edit and update existing posts/pages **Content Organization:** - Set and manage slugs/permalinks - Assign existing categories and tags to content - Control page hierarchy and parent-child relationships - Manage post status (draft, publish, private, etc.) **Publishing Features:** - Schedule posts for future publication - Save as drafts - Publish immediately - Control visibility settings - Set post formats **Comment Management:** - Enable/disable comments on posts - Moderate existing comments **Bulk Operations:** - Delete multiple posts/pages - Update multiple items ### Limitations: - **SEO optimization**: Cannot evaluate or optimize SEO elements (keywords, metadata, structure) - **Image management**: Cannot upload or insert images during initial post/page creation (requires separate editing step) - **Taxonomy creation**: Cannot create new categories/tags while creating content (must exist beforehand) - **Simultaneous operations**: Cannot create taxonomies and content in the same action - **Alt text**: Cannot optimize image alt text for SEO - **Link analysis**: Cannot analyze internal/external link structure - **Content analysis**: Cannot provide readability scores or content optimization suggestions - **Custom fields**: Limited support for complex custom field types without plugins - **Homepage**: Cannot locate or set the home page, for that use the wp admin`,capabilities:{resources:{subscribe:!0}}}),t=RL();return AL(e,t),nv().catch(n=>{console.error("[WordPress Posts Server] Post type initialization failed:",n)}),e.registerTool("wp-get-posts",{description:'Retrieves WordPress content items with optional filtering and pagination. Use this when browsing or searching multiple posts/pages by criteria like author, category, or keywords. IMPORTANT: For accurate total counts including drafts/private content, use status="any". By default returns only published content. Returns array of content objects with metadata and total counts.',inputSchema:{...soe.shape,postType:ts.optional().default("post").describe('The post type to retrieve (e.g., "post", "page", "product", "wp_block"). Defaults to "post"')},annotations:{title:"Get Posts",[Ee]:!0}},async n=>{const{postType:r,...o}=n;console.log("[WordPress Posts Server] wp-get-posts",{postType:r,...o});try{o.search&&!o.status&&(o.status="any");const i=ir(await ki(r),o),s=await B(i,"GET"),a=o.status||$L.PUBLISH;return{content:[{type:"text",text:`Total ${r} items with status "${a}": ${s.totalItems} items across ${s.totalPages||1} pages Response data: ${JSON.stringify(s.data,null,2)}`}]}}catch(i){throw console.error("[WordPress Posts Server] wp-get-posts error:",i),new Error(`Error retrieving ${r} items: ${i.message}`)}}),e.registerTool("wp-get-post",{description:"Fetches a specific WordPress content item by its ID and post type. Use this tool when you need complete details about a single content item (post, page, product, etc.) that you already know the ID and type for. Supports all registered post types including custom post types. Returns a single content object with its full content and metadata.",inputSchema:{id:M().describe("The ID of the content item to retrieve"),postType:ts.optional().default("post").describe('The post type of the item to retrieve (e.g., "post", "page", "product", "wp_block"). Defaults to "post"')},annotations:{title:"Get Post",[Ee]:!0}},async({id:n,postType:r})=>{console.log("[WordPress Posts Server] wp-get-post",{id:n,postType:r});try{const o=await ki(r),s=(await B(`${o}/${n}`,"GET")).data;return{content:[{type:"text",text:JSON.stringify(s,null,2)}]}}catch(o){throw console.error("[WordPress Posts Server] wp-get-post error:",o),new Error(`Error retrieving ${r} item ${n}: ${o.message}`)}}),e.registerTool("wp-create-posts-bulk",{description:`Creates multiple WordPress content items of any post type with the provided content and attributes. All new posts, pages are automatically saved in draft mode for review. Use this tool when you need to programmatically add multiple content items to the site (posts, pages, etc.). Supports all registered post types including custom post types. Returns confirmation of the created content items with their new IDs. Prefer using the wp-import-posts-from-file tool for uploading posts from files. **CRITICAL - Post Type Selection:** - When user asks to create a "page" → use type: "page" - When user asks to create a "post" or "blog post" → use type: "post" - For custom post types (e.g., "event", "testimonial", "portfolio") → use the specific type name on every post in the batch (must match relevantPostType) - Elementor Theme Builder templates (header, footer, popup, archive, single, etc.) → use type: "elementor_library" (requires Elementor Pro). Read wp-post-meta-schema for elementor_library to get valid _elementor_template_type values. Required meta for empty templates: _elementor_edit_mode: "builder", _elementor_template_type: "", _elementor_data: "[]". Minimal or empty content is fine for empty templates. - If missing a known custom post type, suggest the user to install the relevant plugin. This tool is not for creating product posts, use dedicated WooCommerce tools for that (if WooCommerce is not installed, suggest the user to install it).`,inputSchema:{posts:te(PL.extend({title:b().describe("Post title - should be engaging and visitor-facing, suitable for public consumption. For blog posts, create compelling headlines that would attract readers."),content:b().describe(`Post content - for blog posts use polished content (500+ words when appropriate). For empty Elementor templates (elementor_library), minimal or empty content is acceptable. ${YI}`),type:ve(t).describe('REQUIRED: The WordPress post type to create. Use "page" when user asks to create a page. Use "post" when user asks to create a blog post. Use specific custom post type names for other content (e.g., "event", "testimonial"). This field must match what the user requested.'),meta:sn(Hr()).default({}).describe("Custom meta fields. Use the meta schema to determine and fill the relevant meta fields. In case no meta needed, leave it empty."),acf:sn(Hr()).default({}).describe("Custom ACF fields. Use the acf schema to determine and fill the relevant ACF fields. In case no ACF needed, leave it empty."),parent:M().optional().default(0).describe("The ID of the parent page. ONLY provide if post type is hierarchical and user explicitly asked for it to be a child page. Defaults to 0 (no parent).")})).describe("Must ask the user to provide missing parameters (title and content). Don't invent values."),relevantPostType:b().describe('The content type the user explicitly requested. Must be "page" if user said "page", "post" if user said "post" or "blog post", or the specific custom post type name.')},annotations:{title:"Create Posts Bulk"},_meta:{[Ie]:[{uri:`${Ql}/{postType}`,whenToUse:"When creating posts to determine available meta fields for the specific post type",params:{postType:"Take from the resource list"}}]}},async n=>{const{posts:r}=n;console.log("[WordPress Posts Server] wp-create-post",{posts:r});try{const o=[],i=[],s=[];(await Promise.allSettled(r.map(async p=>{const{type:m,...h}=p,w=await ki(m,!0);h.content=h.content||ec.POST_CONTENT,h.title=h.title||ec.POST_TITLE,h.status=h.status||ec.POST_STATUS,h.meta=h.meta||{},h.acf=h.acf||{};const f=(await B(w,"POST",h)).data;return NL(h,f,m,f.id,"create"),await coe(f.id,w),{result:f,type:m}}))).forEach((p,m)=>{p.status==="fulfilled"?s.push({id:p.value.result.id,title:r[m].title||ec.POST_TITLE,type:p.value.type}):(console.error("[WordPress Posts Server] Error creating post:",p.reason),i.push({title:r[m].title||ec.POST_TITLE,error:p.reason.message}))}),s.forEach(p=>{o.push({id:p.id,status:$L.DRAFT,title:p.title,type:p.type})});const l=o.length>0?`Successfully created ${o.length} posts: ${o.map(p=>`- ${p.title} (ID: ${p.id}, Status: ${p.status})`).join(` `)}`:"",c=i.length>0?` Errors encountered: ${i.map(p=>`- ${p.title}: ${p.error}`).join(` `)}`:"",u=o.length===1&&o[0].type==="page"?", Ask user what editor he would like to use to edit the page that created: Gutenberg, Elementor ?":'Suggest the following quick user replies: "Publish it", "Open it in editor", "Try another version"',d={success:i.length===0,successMessage:l,errorMessage:c,editorQuestion:u,total_posts:r.length,successful_count:o.length,failed_count:i.length,created_posts:o.map(p=>({id:p.id,title:p.title,status:p.status,type:p.type,editUrl:`${rv()}/wp-admin/post.php?post=${p.id}&action=edit`})),failed_posts:i.map(p=>({title:p.title,error:p.error}))};return{content:[{isError:i.length>0,type:"text",text:JSON.stringify(d,null,2)}]}}catch(o){throw console.error("[WordPress Posts Server] wp-create-post error:",o),new Error(`Error creating posts: ${o.message}`)}}),e.registerTool("wp-update-post",{description:`Updates existing WordPress content with safety protections that preserve publication status by default. This tool modifies content that already exists in the database without accidentally changing published posts to drafts. Use this when you need to edit existing content (posts, pages, products, etc.) while maintaining their current publication state. To schedule a post for future publication: set both "date" to a future date/time (ISO8601 format) AND "status" to "future" The tool will return success confirmation and automatically excludes status changes unless explicitly requested via updateStatus parameter. Supports all registered post types including custom post types - You must specify the correct postType that matches your content (e.g., "page" for pages, "product" for WooCommerce products). Do not use this tool to update a post that the is currently being edited in the Gutenberg editor. `,inputSchema:{id:M().describe("The ID of the content item to update"),post:PL.describe("The updated content data"),postType:ts.optional().default("post").describe('The post type of the item to update (e.g., "post", "page", "product", "wp_block"). Defaults to "post"'),updateStatus:Y().optional().default(!1).describe("Set to true to update publication status. By default, existing status is preserved to protect live content.")},annotations:{title:"Update Post"},_meta:{[Ie]:[{uri:`${Ql}/{postType}`,whenToUse:"When updating posts to determine available meta fields for the specific post type",params:{postType:"Take from the resource list"}}]}},async({id:n,post:r,postType:o,updateStatus:i})=>{var a,l,c,u,d;console.log("[WordPress Posts Server] wp-update-post",{id:n,post:r,postType:o,updateStatus:i});const s=((c=(l=(a=window.wp)==null?void 0:a.data)==null?void 0:l.select("core/editor"))==null?void 0:c.getCurrentPostId())||0;if(s===n)return{content:[{type:"text",text:`The user is currently editing post ${s}, as an LLM - use other tools for updating on the screen as a draft and not to update the db directly.`}]};try{const p=await ki(o),m=H3(r,i),w=(await B(`${p}/${n}`,"PUT",m)).data;return NL(m,w,o,n,"update"),{content:[{type:"text",text:`${((u=In[o])==null?void 0:u.name)||o} "${((d=w.title)==null?void 0:d.rendered)||"Untitled"}" (ID: ${w.id}) updated successfully.`}]}}catch(p){throw console.error("[WordPress Posts Server] wp-update-post error:",p),new Error(`Error updating ${o} ${n}: ${p.message}`)}}),e.registerTool("wp-get-post-templates",{description:"Retrieves all available templates for any WordPress post type. Use this tool when you need to see what templates are available before setting a template on content items (pages, posts, custom post types, etc.). Returns an object mapping template file names to their display names.",inputSchema:{postType:ts.optional().default("page").describe('The post type to get templates for (e.g., "page", "post", "product"). Defaults to "page"')},annotations:{title:"Get Post Templates",[Ee]:!0}},async({postType:n})=>{console.log("[WordPress Posts Server] wp-get-post-templates",{postType:n});try{const r=ir("/angie/v1/page-templates",{post_type:n}),i=(await B(r,"GET")).data;return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}catch(r){throw console.error("[WordPress Posts Server] wp-get-post-templates error:",r),new Error(`Error retrieving ${n} templates: ${r.message}. Note: This requires the Angie plugin with page templates endpoint.`)}}),e.registerTool("wp-set-post-template",{description:"Sets the template for any WordPress content item. Use this tool when you need to change a content item's template (pages, posts, custom post types, etc.). If you get an error about invalid template, the error message will show you the valid template options available on this specific WordPress site. Use the returned mapping to find the correct template id by its name.",inputSchema:{id:M().describe("The ID of the content item to update"),template:b().describe("The template slug to apply, or empty string for default template"),postType:ts.optional().default("page").describe('The post type of the item to update (e.g., "page", "post", "product"). Defaults to "page"')},annotations:{title:"Set Post Template"}},async({id:n,template:r,postType:o})=>{var i,s;console.log("[WordPress Posts Server] wp-set-post-template",{id:n,template:r,postType:o});try{const a=await ki(o),c=(await B(`${a}/${n}`,"PUT",{template:r})).data;return{content:[{type:"text",text:`${((i=In[o])==null?void 0:i.name)||o} template updated successfully. "${((s=c.title)==null?void 0:s.rendered)||"Untitled"}" (ID: ${n}) now uses template: "${r||"default"}".`}]}}catch(a){throw console.error("[WordPress Posts Server] wp-set-post-template error:",a),new Error(`Error setting ${o} template for item ${n}: ${a.message}`)}}),e.registerTool("wp-delete-posts",{description:"Removes WordPress content items (posts, pages, products, etc.) from the site permanently or moves to the trash. Use this tool when you need to delete content items, NOT to delete post type definitions themselves. This deletes content instances, not the post type schema. Supports bulk deletion of multiple content items. Supports all registered post types including custom post types. Returns confirmation with results for each post processed.",inputSchema:{ids:te(M()).describe("The IDs of the specific content items to delete (not the post type definition, but the individual content instances)"),postType:ts.optional().default("post").describe('The post type that the content items belong to (e.g., "post", "page", "product", "wp_block"). This specifies which content type the items are, not which post type definition to delete. Defaults to "post". All items in the bulk operation must be of the same post type.'),confirmationMessage:b().describe(`A clear explanation of what will be deleted and its impact (this would be shown to the user before deletion to ensure they understand the consequences of this irreversible action). Example: "You're about to permanently delete 5 blog posts. This action cannot be undone and will remove all content, potentially breaking links that reference these posts."`)},annotations:{title:"Delete Posts",destructiveHint:!0}},async({ids:n,postType:r,confirmationMessage:o})=>{var s,a;console.log("[WordPress Posts Server] wp-delete-posts",{ids:n,postType:r,confirmationMessage:o}),ns(o,"Post deletion");const i=async l=>{var c;try{const u=await ki(r),p=(await B(`${u}/${l}`,"GET")).data,m=`${u}/${l}`;return await B(m,"DELETE"),{id:l,success:!0,title:((c=p.title)==null?void 0:c.rendered)||p.name||"Untitled",post_type:r,error:null}}catch(u){console.error(`[WordPress Posts Server] wp-delete-post error for ID ${l}:`,u);let d=u.message??"";return d.includes("rest_post_invalid_id")&&(d=`Post ID ${l} was already deleted`),{id:l,success:!1,title:null,post_type:r,error:d}}};try{const l=n.map(h=>i(h)),u=(await Promise.allSettled(l)).map(h=>{var w;return h.status==="fulfilled"?h.value:{id:0,success:!1,title:null,post_type:r,error:((w=h.reason)==null?void 0:w.message)||"Unknown error"}}),d=u.filter(h=>h.success),p=u.filter(h=>!h.success),m={success:p.length===0,message:p.length===0?`All ${n.length} ${((s=In[r])==null?void 0:s.name)||r} items deleted successfully`:`${d.length} of ${n.length} ${((a=In[r])==null?void 0:a.name)||r} items deleted successfully, ${p.length} failed`,total_posts:n.length,post_type:r,successful_deletions:d.length,failed_deletions:p.length,deleted_posts:d.map(h=>({id:h.id,title:h.title,post_type:h.post_type})),failed_posts:p.map(h=>({id:h.id,error:h.error}))};return{content:[{type:"text",text:JSON.stringify(m,null,2)}]}}catch(l){throw console.error("[WordPress Posts Server] wp-delete-posts error:",l),new Error(`Error deleting ${r} posts: ${l.message}`)}}),e.registerTool("wp-get-post-types",{description:"Retrieves all registered post types on the WordPress site with their complete configuration. Use this tool when you need to discover what content types are available before working with posts, or when you need detailed information about post type capabilities and settings. Returns an object mapping post type names to their complete schema definitions including REST endpoints, taxonomies, and capabilities.",inputSchema:{},annotations:{title:"Get Post Types",[Ee]:!0}},async()=>{console.log("[WordPress Posts Server] wp-get-post-types");try{return await nv(),{content:[{type:"text",text:JSON.stringify(In,null,2)}]}}catch(n){throw console.error("[WordPress Posts Server] wp-get-post-types error:",n),new Error(`Error retrieving post types: ${n.message}`)}}),e.registerTool("wp-add-post-terms",{description:"Assigns taxonomy terms to any WordPress content type. Use this tool when you need to categorize content or add tags to it (posts, pages, products, etc.).By default, appends new terms to existing ones (append=true) to prevent data loss. Set append=false to replace all terms instead. Supports all registered post types that have taxonomies. Returns confirmation that the terms were successfully assigned to the content item. This tool is NOT for WooCommerce so **do NOT use it for WooCommerce products!**. NEVER assume a taxonomy ID, if its unknown use the taxonomy search tool.Note the order of execution if trying to assign new terms",inputSchema:{postId:M().describe("The content item ID"),taxonomy:b().describe('The taxonomy slug (e.g., "category", "post_tag", "product_cat")'),terms:te(M()).describe("Array of term IDs to assign to the content item"),postType:ts.optional().default("post").describe('The post type of the item to update (e.g., "post", "page", "product"). Defaults to "post"'),append:Y().optional().default(!0).describe("Whether to append terms (true) or replace all terms (false). Defaults to true to prevent data loss.")},annotations:{title:"Add Post Terms"}},async({postId:n,taxonomy:r,terms:o,postType:i,append:s=!0})=>{var a;console.log("[WordPress Posts Server] wp-add-post-terms",{postId:n,taxonomy:r,terms:o,postType:i,append:s});try{const[l,c]=await Promise.all([ki(i),YC(r)]),{valid:u,invalid:d}=await G3(r,o);if(d.length>0)return{content:[{type:"text",text:`LLM Instruction: The following term IDs do not exist in the "${r}" taxonomy: [${d.join(", ")}]. Please use the wp-search-taxonomies or wp-create-taxonomy tools to find or create the missing terms first.`}]};let p=u;if(s){const v=(await B(`${l}/${n}`,"GET")).data[c]||[];p=Array.from(new Set([...v,...u]))}const m={[c]:p};return await B(`${l}/${n}`,"PUT",m),{content:[{type:"text",text:`Terms successfully ${s?"added to":"replaced in"} ${((a=In[i])==null?void 0:a.name)||i} ${n} for taxonomy ${r}. Field used: ${c}, Final terms: [${p.join(", ")}]`}]}}catch(l){throw console.error("[WordPress Posts Server] wp-add-post-terms error:",l),new Error(`Error adding terms to ${i} ${n} for taxonomy ${r}: ${l.message}`)}}),e.registerTool("wp-import-posts-from-file",{description:`Importing posts from file into WordPress. Use this tool in order to add posts (or pages, products or any other custom post types) to wordpress from file, whether a CSV, XML, or other formats.`,inputSchema:{isCsvFile:Y().describe("Is the file a CSV file?")},annotations:{title:"Import Posts from File"}},async({isCsvFile:n})=>{try{const r={importSteps:[]};let o=1;return n&&r.importSteps.push({step:o++,action:"Confirm CSV column mapping",description:`Parse the CSV headers yourself, generate a best-guess mapping to WordPress post fields. Provide the complete mapping to the user and ask him to confirm it. Do not proceed until the user confirms the mapping.`}),r.importSteps.push({step:o++,action:"Create missing taxonomies",description:`Create any required taxonomies that don't exist. You should use the following tools: wp-get-taxonomies, wp-get-taxonomy, wp-create-taxonomy, wp-update-taxonomy, wp-search-taxonomies.`}),r.importSteps.push({step:o++,action:"Create custom fields",description:"Add missing custom fields. First call get-fields and then create-field tool for each field that does not exist."}),r.importSteps.push({step:o++,action:"Create the posts",description:"Import all content as posts. Use the wp-create-post tool for each post."}),r.importSteps.push({step:o++,action:"Handle errors",description:`If error, explain the issue to the user and suggest a solution. For instance, if the user tries to import custom fields but you are unable to create them using ACF tools, then explain that to the user and suggest installing the ACF plugin.`}),r.importSteps.push({step:o++,action:"Navigate to posts page",description:"Must **suggest** taking the user to see all imported posts/pages using the navigation tools (suggest only, do not do it without user consent) "}),{content:[{type:"text",text:`You (not the user) must execute each of the following steps in order to complete the import process: ${JSON.stringify(r,null,2)} - You should use the available tools to execute the plan. - Do not return the plan to the user, just execute it. `}]}}catch(r){throw console.error("[WordPress Posts Server] wp-import-posts-from-file error:",r),new Error(`Error creating import plan: ${r.message}`)}}),wn("edit.php")&&(!wn("post_type=")||wn("post_type=post"))&&Qt(e,roe),wn("edit.php")&&wn("post_type=page")&&Qt(e,ooe),e}const yoe=[{title:"Create categories",name:"create-categories",description:"Create new categories called [category names]"},{title:"Assign new tag",name:"assign-new-tag",description:"Create new tag called [tag name] and assign it to all posts in category [category name]"},{title:"Cleanup unused tags",name:"cleanup-unused-tags",description:"Identify all tags that currently have 0 posts assigned to them and provide me with a complete list to review. Do not delete any tags until I have reviewed the list and given you explicit approval to proceed"},{title:"Rename categories",name:"rename-categories",description:"Find and rename categories that need consistency fixes (capitalization, spelling, formatting) and show me the suggested changes before applying them"},{title:"Merge duplicate tags",name:"merge-duplicate-tags",description:'Find tags with similar names (like "SEO" and "seo-tips") and suggest which ones should be merged. Show me the recommendations before merging so I can approve the changes'},{title:"Set parent category",name:"set-parent-category",description:"Set up a category structure with [parent category] containing these child categories: [list child categories]"}],bS="wp-taxonomy-schema",fg=`wp://${bS}/{taxonomy}`,woe="wp-taxonomies",ES="wp://taxonomies";async function voe(){const e=new mt({name:"wp-taxonomy-server",version:"1.0.0",title:"WP Taxonomies"},{instructions:`## WordPress Taxonomy Management ### Capabilities: **Taxonomy Operations (CRUD):** - Create new taxonomies (categories, tags, custom taxonomies) - Read/retrieve taxonomy information - Update existing taxonomies - Delete single or multiple taxonomies **Taxonomy Management:** - View all registered taxonomies - Search taxonomies by name or ID - Get full taxonomy details and metadata - Edit taxonomy properties: - Names and labels - Descriptions - Slugs - Parent-child relationships **Content Assignment:** - Assign existing taxonomies to posts - Assign taxonomies to pages - Link taxonomies to custom post types - Manage taxonomy-content relationships ### Limitations: - **Simultaneous creation**: Cannot create new taxonomies and new content in the same action - **Auto-assignment**: Cannot create and assign new taxonomies during content creation - **Bulk operations**: Limited bulk taxonomy operations - **Custom fields**: Cannot add custom fields to taxonomy terms without plugins - **Hierarchy limits**: Cannot create deeply nested taxonomy structures efficiently - **Taxonomy registration**: Cannot register new taxonomy types (only create terms) - **Advanced queries**: Cannot perform complex taxonomy queries or filters`,capabilities:{resources:{subscribe:!0}}});return await Ra().catch(t=>{console.error("[WordPress Taxonomy Server] Taxonomy initialization failed:",t)}),e.resource(woe,ES,{title:"WP Taxonomies",description:"List of all registered taxonomies on the WordPress site"},async()=>{console.log(`[WP Taxonomy Server] Resource accessed: ${ES}`);const t=await Ra();return{contents:[{uri:ES,mimeType:"application/json",text:JSON.stringify(t,null,2)}]}}),e.resource(bS,new Xr(fg,{list:async()=>{const t=await Ra();return{resources:Object.keys(t).map(n=>({uri:fg.replace("{taxonomy}",n),name:`${bS}-${n}`,title:`WP Taxonomy Schema (${n})`,description:`Taxonomy schema for ${n}`,mimeType:"application/json"}))}}}),{title:"WP Taxonomy Schema",description:"Taxonomy schema for a specific taxonomy"},async(t,n)=>{console.log(`[WP Taxonomy Server] Resource handler called with URI: ${t}, variables:`,n);const r=Array.isArray(n.taxonomy)?n.taxonomy[0]:n.taxonomy,o=await W3(r);return{contents:[{uri:t.toString(),mimeType:"application/json",text:JSON.stringify(o,null,2)}]}}),e.registerTool("wp-get-taxonomies",{description:"Retrieves all registered taxonomies on the WordPress site. Use this tool to discover what classification systems (like categories and tags) are available. Returns an object mapping taxonomy names to their schema definitions.",inputSchema:vS.shape,annotations:{title:"Get Taxonomies",[Ee]:!0}},async t=>{console.log("[WordPress Taxonomy Server] wp-get-taxonomies",t);try{const n=await Ra();return{content:[{type:"text",text:JSON.stringify(n,null,2)}]}}catch(n){throw console.error("[WordPress Taxonomy Server] wp-get-taxonomies error:",n),new Error(`Error retrieving taxonomies: ${n.message}`)}}),e.registerTool("wp-get-all-taxonomies",{description:"Retrieves all taxonomies of a specific type from the WordPress site. Use this tool when you need to get a complete list of categories, tags, or custom taxonomy terms without filtering by name or search criteria. This is ideal for populating dropdowns, displaying full taxonomy lists, or assigning all taxonomies of a kind to a post. Returns an array of all taxonomy objects for the specified type.",inputSchema:{...vS.shape,taxonomy:Xl.optional().default("post_tag").describe('The taxonomy type to retrieve all items from (e.g., "category", "post_tag", "product_cat", "product_tag", "product_type" by WooCommerce). Defaults to "post_tag"')},annotations:{title:"Get All Taxonomies",[Ee]:!0}},async t=>{const{taxonomy:n,search:r,...o}=t;console.log("[WordPress Taxonomy Server] wp-get-all-taxonomies",{taxonomy:n,...o});try{const i=ir(await _s(n),o),a=(await B(i,"GET")).data;return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}catch(i){throw console.error("[WordPress Taxonomy Server] wp-get-all-taxonomies error:",i),new Error(`Error retrieving all ${n} taxonomies: ${i.message}`)}}),e.registerTool("wp-search-taxonomies",{description:"Searches for taxonomies by name. Use this tool when you need to find taxonomies by their name instead of ID. Supports all registered taxonomies including custom taxonomies (e.g. product_type by WooCommerce or other custom taxonomies). Returns an array of matching taxonomy objects. NEVER assume ID, if its unknown use search",inputSchema:{...vS.shape,taxonomy:Xl.optional().default("post_tag").describe('The taxonomy to search within (e.g., "category", "post_tag", "product_cat", "product_tag", "product_type" by WooCommerce). Defaults to "post_tag"'),search:b().describe("The taxonomy name to search for")},annotations:{title:"Search Taxonomies",[Ee]:!0}},async t=>{const{taxonomy:n,...r}=t;console.log("[WordPress Taxonomy Server] wp-search-taxonomies",{taxonomy:n,...r});try{const o=ir(await _s(n),r),s=(await B(o,"GET")).data;return{content:[{type:"text",text:JSON.stringify(s,null,2)}]}}catch(o){throw console.error("[WordPress Taxonomy Server] wp-search-taxonomies error:",o),new Error(`Error searching ${n} taxonomies: ${o.message}`)}}),e.registerTool("wp-get-taxonomy",{description:"Retrieves a specific WordPress taxonomy by its ID. Use this tool when you need details about a particular taxonomy (category, tag, custom taxonomy, etc., e.g. product_type by WooCommerce or other custom taxonomies). Returns a single taxonomy object with its full details.",inputSchema:{id:M().describe("The ID of the taxonomy to retrieve"),taxonomy:Xl.optional().default("post_tag").describe('The taxonomy the taxonomy belongs to (e.g., "category", "post_tag", "product_cat", "product_tag", "product_type" by WooCommerce). Defaults to "post_tag"')},annotations:{title:"Get Taxonomy",[Ee]:!0}},async({id:t,taxonomy:n})=>{console.log("[WordPress Taxonomy Server] wp-get-taxonomy",{id:t,taxonomy:n});try{const r=await _s(n),i=(await B(`${r}/${t}`,"GET")).data;return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}catch(r){throw console.error("[WordPress Taxonomy Server] wp-get-taxonomy error:",r),new Error(`Error retrieving ${n} taxonomy ${t}: ${r.message}`)}}),e.registerTool("wp-create-taxonomy",{description:"Creates a new WordPress taxonomy. Use this tool when you need to add a new taxonomy (categories, tags, custom taxonomies, etc., e.g. product_type by WooCommerce or other custom taxonomies). Supports all registered taxonomies including custom taxonomies. Returns the newly created taxonomy object with its assigned ID.",inputSchema:{name:b().describe("The name of the taxonomy (required). The slug will be automatically generated from the name if not provided."),taxonomy:Xl.optional().default("post_tag").describe('The taxonomy to create the taxonomy in (e.g., "category", "post_tag", "product_cat", "product_tag", "product_type" by WooCommerce). Defaults to "post_tag"'),description:b().optional().describe(`The description of the taxonomy. ${ou}`),slug:b().optional().describe("The URL-friendly slug (alphanumeric identifier). If not provided, WordPress will automatically generate one from the name. Custom slugs should be lowercase, hyphenated, and SEO-friendly."),parent:M().optional().describe("The parent taxonomy ID (for hierarchical taxonomies like categories)"),meta:sn(Hr()).optional().describe("Custom meta fields. Use the meta schema to determine and fill the relevant meta fields.")},annotations:{title:"Create Taxonomy"},_meta:{[Ie]:[{uri:`${fg}`,whenToUse:"When creating taxonomies to determine available meta fields for the specific taxonomy type",params:{taxonomy:"Take from the resource list"}}]}},async t=>{var o;const{taxonomy:n,...r}=t;console.log("[WordPress Taxonomy Server] wp-create-taxonomy",{taxonomy:n,...r});try{const i=await _s(n),a=(await B(i,"POST",r)).data;return{content:[{type:"text",text:`${((o=Pn[n])==null?void 0:o.name)||n} taxonomy "${a.name}" created successfully. ID: ${a.id}`}]}}catch(i){throw console.error("[WordPress Taxonomy Server] wp-create-taxonomy error:",i),new Error(`Error creating ${n} taxonomy: ${i.message}`)}}),e.registerTool("wp-update-taxonomy",{description:"Modifies an existing WordPress taxonomy. Use this tool when you need to edit a taxonomy's name, description, or other attributes (categories, tags, custom taxonomies, etc., e.g. product_type by WooCommerce or other custom taxonomies). Supports all registered taxonomies including custom taxonomies. Returns the updated taxonomy object.",inputSchema:{id:M().describe("The ID of the taxonomy to update"),taxonomy:Xl.optional().default("post_tag").describe('The taxonomy the taxonomy belongs to (e.g., "category", "post_tag", "product_cat", "product_tag", "product_type" by WooCommerce). Defaults to "post_tag"'),name:b().optional().describe("The updated name of the taxonomy. When updating the name, either update the slug or at least suggest to the user to update the slug to maintain URL consistency and SEO benefits."),description:b().optional().describe(`The updated description of the taxonomy. ${ou}`),slug:b().optional().describe("The updated URL-friendly slug (alphanumeric identifier). It should ALWAYS match the name for consistency (unless if explicitly stated otherwise). WordPress automatically generates slugs from names, but you can provide a custom one."),parent:M().optional().describe("The updated parent taxonomy ID (for hierarchical taxonomies)"),meta:sn(Hr()).optional().describe("Updated custom meta fields. Use the meta schema to determine and fill the relevant meta fields.")},annotations:{title:"Update Taxonomy"},_meta:{[Ie]:[{uri:`${fg}`,whenToUse:"When updating taxonomies to determine available meta fields for the specific taxonomy type",params:{taxonomy:"Take from the resource list"}}]}},async({id:t,taxonomy:n,...r})=>{var o;console.log("[WordPress Taxonomy Server] wp-update-taxonomy",{id:t,taxonomy:n,...r});try{const i=await _s(n),a=(await B(`${i}/${t}`,"POST",r)).data;return{content:[{type:"text",text:`${((o=Pn[n])==null?void 0:o.name)||n} taxonomy "${a.name}" updated successfully. ID: ${a.id}`}]}}catch(i){throw console.error("[WordPress Taxonomy Server] wp-update-taxonomy error:",i),new Error(`Error updating ${n} taxonomy ${t}: ${i.message}`)}}),e.registerTool("wp-delete-taxonomies",{description:"Removes WordPress taxonomies from the site. Use this tool when you need to delete obsolete or mistakenly created taxonomies (categories, tags, custom taxonomies, etc.). Supports bulk deletion of multiple taxonomy items. Supports all registered taxonomies including custom taxonomies. Returns confirmation with results for each taxonomy processed.",inputSchema:{ids:te(M()).describe("The IDs of the taxonomies to delete"),taxonomy:Xl.optional().default("post_tag").describe('The taxonomy type that the items belong to (e.g., "category", "post_tag", "product_cat", "product_tag", "product_type" by WooCommerce). Defaults to "post_tag". All items in the bulk operation must be of the same taxonomy type.'),confirmationMessage:b().describe(`A clear explanation of what will be deleted and its impact (this would be shown to the user before deletion to ensure they understand the consequences of this irreversible action). Example: "You're about to permanently delete 5 tags. This action cannot be undone and will remove these tags from all associated posts."`)},annotations:{title:"Delete Taxonomies",destructiveHint:!0}},async({ids:t,taxonomy:n})=>{var o,i;console.log("[WordPress Taxonomy Server] wp-delete-taxonomies",{ids:t,taxonomy:n});const r=async s=>{try{const a=await _s(n),c=(await B(`${a}/${s}`,"GET")).data;return await B(`${a}/${s}?force=true`,"DELETE"),{id:s,success:!0,name:c.name||"Unnamed Taxonomy",taxonomy_type:n,error:null}}catch(a){return console.error(`[WordPress Taxonomy Server] wp-delete-taxonomy error for ID ${s}:`,a),{id:s,success:!1,name:null,taxonomy_type:n,error:a.message}}};try{const s=t.map(p=>r(p)),l=(await Promise.allSettled(s)).map(p=>{var m;return p.status==="fulfilled"?p.value:{id:0,success:!1,name:null,taxonomy_type:n,error:((m=p.reason)==null?void 0:m.message)||"Unknown error"}}),c=l.filter(p=>p.success),u=l.filter(p=>!p.success),d={success:u.length===0,message:u.length===0?`All ${t.length} ${((o=Pn[n])==null?void 0:o.name)||n} items deleted successfully`:`${c.length} of ${t.length} ${((i=Pn[n])==null?void 0:i.name)||n} items deleted successfully, ${u.length} failed`,total_taxonomies:t.length,taxonomy_type:n,successful_deletions:c.length,failed_deletions:u.length,deleted_taxonomies:c.map(p=>({id:p.id,name:p.name,taxonomy_type:p.taxonomy_type})),failed_taxonomies:u.map(p=>({id:p.id,error:p.error}))};return{content:[{type:"text",text:JSON.stringify(d,null,2)}]}}catch(s){throw console.error("[WordPress Taxonomy Server] wp-delete-taxonomies error:",s),new Error(`Error deleting ${n} taxonomies: ${s.message}`)}}),(wn("taxonomy=category")||wn("taxonomy=post_tag"))&&Qt(e,yoe),e}const _oe=[{title:"Create image",name:"create-image",description:"Create an image of [description]"},{title:"Remove background",name:"remove-background",description:"Remove the background from [image name]"},{title:"Find unused media",name:"find-unused-media",description:"Using code, scan my media library for images and files that aren't used anywhere on my site, add a button to view the list, and let me select which ones to safely delete"},{title:"Bulk update alt text",name:"bulk-update-alt-text",description:"Add descriptive alt text to all images missing it, using AI to analyze the images and generate SEO-friendly descriptions"},{title:"Organize media into folders",name:"organize-media-into-folders",description:"Using code, create a folder structure in my media library: [folder names]"}];function SS(e){var i;const t=e==null?void 0:e.content,n=Array.isArray(t)?t.find(s=>s.type==="text"):t,r=(n==null?void 0:n.type)==="text"?n.text:void 0,o=typeof((i=e==null?void 0:e._meta)==null?void 0:i.samplingTraceId)=="string"?e._meta.samplingTraceId:void 0;return{text:r,samplingTraceId:o}}const LL=e=>Array.isArray(e)?e.map(t=>{var n;return{id:t.id,title:((n=t.title)==null?void 0:n.rendered)||t.slug||"Untitled",alt_text:t.alt_text||"",source_url:t.source_url,media_type:t.media_type,date:t.date}}):e,boe=()=>`${window.location?`${window.location.protocol}//${window.location.hostname}`:""}/wp-includes/images/media/default.png`,Eoe=async e=>{try{const t=await fetch(e,{mode:"cors",credentials:"same-origin"});if(!t.ok)return null;const n=await t.blob();return new Promise(r=>{const o=new Image,i=URL.createObjectURL(n);o.onload=()=>{URL.revokeObjectURL(i);const s=800;let a=o.width,l=o.height;if(a>s){const d=a/l;a=s,l=Math.round(a/d)}const c=document.createElement("canvas");c.width=a,c.height=l;const u=c.getContext("2d");if(!u){r(null);return}u.drawImage(o,0,0,a,l);try{const d=c.toDataURL("image/jpeg",.9);r(d)}catch{try{const p=c.toDataURL("image/png");r(p)}catch{r(null)}}},o.onerror=()=>{URL.revokeObjectURL(i),r(null)},o.src=i})}catch(t){return console.warn("[Image Utils] Failed to fetch image as base64:",{url:e,error:t instanceof Error?t.message:"Unknown error"}),null}};async function Soe(e){var t;try{const r=(await B(`/wp/v2/media/${e}`,"GET")).data;return((t=r==null?void 0:r.meta)==null?void 0:t.angie_ai_description)||null}catch{return null}}async function Toe(e,t){await B(`/wp/v2/media/${e}`,"PUT",{meta:{angie_ai_description:t}})}async function ML(e,t,n){try{const r=await Soe(t);if(r)return{description:r};const o=await Eoe(n);if(!o)throw new Error("Failed to fetch image as base64");const i=await e.server.request({method:"sampling/createMessage",params:{messages:[{role:"user",content:{type:"text",text:"Analyze this image and provide a detailed description."},input_image:{image_url:o}}],maxTokens:1e3,chatId:`media-analysis-${t}-${Date.now()}`,modelPreferences:{hints:[{name:"openai"}]},metadata:{action:"analyze-media-image",mediaId:t,structured_output:{type:"object",properties:{description:{type:"string",description:"Detailed description of the image"}},required:["description"],additionalProperties:!1}}}},Pc),{text:s}=SS(i);if(s){let a;try{a=JSON.parse(s).description}catch{a=s}return await Toe(t,a),{description:a}}throw new Error("No analysis result received")}catch(r){throw console.error("[Image Analysis] Failed to analyze image:",{imageId:t,error:r instanceof Error?r.message:"Unknown error"}),new Error(`Failed to analyze image ${t}: ${r instanceof Error?r.message:"Unknown error"}`)}}async function DL(e,t){if(!Array.isArray(e))return e;const n=10,r=[];for(let o=0;o{if(a.media_type==="image"&&a.source_url)try{const l=await ML(t,a.id,a.source_url);return{...a,aiAnalysis:l}}catch(l){return console.warn("[Media Analysis] Failed to analyze image:",{mediaId:a.id,error:l instanceof Error?l.message:"Unknown error"}),a}return a}));r.push(...s)}return r}const koe=e=>b().refine(t=>{try{const n=new URL(t),r=e();return n.hostname===window.location.hostname||n.href===r}catch{return!1}},{message:"Image URL must be from internal media library. External URLs not allowed. If no internal media library image is matching the request, use the placeholder image: "+e()}).superRefine(async(t,n)=>{try{const r=await fetch(t,{method:"HEAD"});r.ok||n.addIssue({code:Q.custom,message:`Image URL does not exist or is not accessible (HTTP ${r.status}). Please select an existing image from the media library or use the placeholder image: ${e()}`})}catch(r){n.addIssue({code:Q.custom,message:`Failed to validate image URL accessibility: ${r instanceof Error?r.message:"Unknown error"}. Please use the placeholder image: ${e()}`})}}).describe("Image URL - internal media library only, must exist"),xoe={};function Nd(){let e;if(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:wr&&wr.tagName.toUpperCase()==="SCRIPT"&&wr.src||new URL("angie.umd.cjs",document.baseURI).href}<"u"&&xoe?e="https://angie.elementor.com":e=globalThis.__VITE_ANGIE_IFRAME_ORIGIN__,!e)throw new Error("CRITICAL: VITE_ANGIE_IFRAME_ORIGIN is not configured. This is required for secure iframe communication. Please set VITE_ANGIE_IFRAME_ORIGIN in your environment configuration.");return e}function TS(e,t){const n=async r=>{var s;if(!(!(r.origin===Nd())||!(typeof t=="function"?t():Be!=null&&Be[t])))switch(r.data.type){case ce.ANGIE_IMAGE_PREVIEW_TOGGLE:e.onImagePreviewToggle(r.data.payload);break;case ce.ANGIE_IMAGE_PREVIEW_CLEANUP:e.onImagePreviewCleanup();break;case ce.ANGIE_IMAGE_SAVE_TO_GALLERY:if(e.onImageSaveToGallery&&((s=r.ports)!=null&&s[0]))try{const a=await e.onImageSaveToGallery(r.data.payload);r.ports[0].postMessage({success:!0,payload:a})}catch(a){r.ports[0].postMessage({success:!1,error:a instanceof Error?a.message:"Failed to save to gallery"})}break}};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)}const Coe={onImagePreviewToggle:()=>{},onImagePreviewCleanup:()=>{},onImageSaveToGallery:async e=>{try{const t=Date.now(),n=e.filename||"image",r=await Ii({imageUrl:e.imageUrl,filename:`${n}-${t}.png`,title:`Image - ${t}`,altText:""});return console.log("[WordPress Media Server] Image saved to gallery:",r.id),{success:!0,mediaId:r.id}}catch(t){return console.error("[WordPress Media Server] Error saving to gallery:",t),{success:!1,error:t instanceof Error?t.message:"Failed to save to gallery"}}}};function Ioe(){TS(Coe,"general")}function Poe(){const e=new mt({name:"wp-media-server",version:"1.0.0",title:"Media"},{instructions:`## WordPress Media Library Management ### Capabilities: **Media Operations:** - Upload media files to the library - Delete media files - Edit media properties and metadata **Media Properties:** - Update image titles - Modify permalinks - Set alternative text (alt text) - Add captions - Write descriptions - Edit media metadata **Bulk Operations:** - Handle bulk editing of approximately 10 images at a time - Bulk operations available when: - Images are selected from list view - User is on a specific image page - User mentions specific image names ### Limitations: - **Native editing tools**: Cannot use WordPress built-in image editing features: - Cannot crop images - Cannot rotate images - Cannot scale/resize images within WordPress - **Advanced operations**: - Cannot optimize images for web - Cannot convert image formats - Cannot create image galleries directly - **Organization**: - Cannot create media folders or categories - Cannot reorganize media library structure **Note**: For image scaling/resizing needs, use the image editing tools instead of WordPress native features.`,capabilities:{resources:{subscribe:!0}}});return e.registerTool("wp-get-media",{description:'Retrieves WordPress media items with optional filtering. Use this tool when you need to browse or search for images, videos, or other uploaded files. When searching for specific images by description (e.g., "cat image"), this tool will first search by the specific term, and if no results are found, automatically fall back to showing recent images that the user might be referring to. Returns an array of media objects with their URLs and metadata.',inputSchema:{search:b().optional().describe('Search term for media (e.g., "cat", "logo", "product")'),parent:M().optional().describe("Filter by parent post ID"),mediaType:ve(["image","video","audio","application"]).optional().describe("Filter by media type"),mimeType:b().optional().describe("Filter by MIME type"),page:M().optional().describe("Page number"),per_page:M().optional().describe("Number of media items per page"),orderby:ve(["date","id","include","title","slug"]).optional().describe("Order media by"),order:ve(["asc","desc"]).optional().describe("Order direction"),analyzeImages:Y().optional().describe('Set to true to analyze image content using AI and extract detailed descriptions (only applies when mediaType is "image" or when images are in the results)')},annotations:{title:"Get Media",[Ee]:!0}},async t=>{console.log("[WordPress Media Server] wp-get-media",t);try{const n=ir("/wp/v2/media",t),o=(await B(n,"GET")).data;if(t.search&&Array.isArray(o)&&o.length===0){const s=await Roe(t.search,t,e,t.analyzeImages);if(s)return s}let i=LL(o);return t.analyzeImages&&t.mediaType==="image"&&(i=await DL(i,e)),{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}catch(n){throw console.error("[WordPress Media Server] wp-get-media error:",n),new Error(`Error retrieving media: ${n.message}`)}}),e.registerTool("wp-get-media-by-id",{description:"Gets WordPress media library item details by media ID, including the source URL that can be used for image processing. Use this when you have a media ID and need to get the image URL for processing operations like remove background, upscale, etc. Optionally analyzes the image content using AI to extract detailed descriptions.",inputSchema:{mediaId:M().describe("The WordPress media library ID of the image to get details for"),analyzeImage:Y().optional().describe("Set to true to analyze the image content using AI and extract a detailed description including objects, colors, style, and any text visible")},annotations:{title:"Get Media by ID",[Ee]:!0}},async({mediaId:t,analyzeImage:n})=>{var r,o,i,s;console.log("[WordPress Media Server] wp-get-media-by-id",{mediaId:t});try{const l=(await B(`/wp/v2/media/${t}`,"GET")).data;if(!l||!l.source_url)throw new Error(`Media item with ID ${t} not found or has no source URL`);const c={id:l.id,title:((r=l.title)==null?void 0:r.rendered)||l.slug||"Untitled",alt_text:l.alt_text||"",source_url:l.source_url,media_type:l.media_type,mime_type:l.mime_type,date:l.date,caption:((o=l.caption)==null?void 0:o.rendered)||"",description:((i=l.description)==null?void 0:i.rendered)||"",media_details:l.media_details,aiDescription:((s=l.meta)==null?void 0:s.angie_ai_description)||""};if(n&&l.source_url&&!c.aiDescription){const u=await ML(e,t,l.source_url);c.aiDescription=u.description}return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}catch(a){throw console.error("[WordPress Media Server] wp-get-media-by-id error:",a),new Error(`Error retrieving media by ID ${t}: ${a.message}`)}}),e.registerTool("wp-upload-media",{description:`Uploads a media file to WordPress from an external URL. Use this tool when you need to add images or other media to the site from another web location. Also use as a fallback when an image is generated but without an explicit intent for it. Minimum viable action is uploading the image to the media library. Returns the newly created media object with its URL and ID.`,inputSchema:{url:b().describe(`The URL of the media to upload (can be a regular URL or imageRef from ${Da.FETCH_EXTERNAL_IMAGE})`),filename:b().optional().describe("Custom filename for the uploaded media (including extension)"),title:b().optional().describe("The title for the media item"),caption:b().optional().describe("The caption for the media item"),altText:b().optional().describe("The alt text for the media item (for images)"),description:b().optional().describe(`The description for the media item. ${ru}`)},annotations:{title:"Upload Media"}},async({url:t,filename:n,...r})=>{console.log("[WordPress Media Server] wp-upload-media",{url:t,filename:n,...r});try{const o=await Ii({imageUrl:t,filename:n,title:r.title,altText:r.altText,description:r.description,caption:r.caption});return{content:[{type:"text",text:`Media "${o.title}" uploaded successfully. ID: ${o.id}, URL: ${o.url}`}]}}catch(o){throw console.error("[WordPress Media Server] wp-upload-media error:",o),new Error(`Error uploading media from URL ${t}: ${o.message}`)}}),e.registerTool("wp-update-media",{description:"Modifies an existing WordPress media item. Use this tool when you need to update titles, captions, alt text, AI-generated descriptions, or other attributes of uploaded files. Returns confirmation that the media was updated successfully.",inputSchema:{id:M().describe("The ID of the media item to update"),title:fe({raw:b().optional().describe("The updated title")}).optional().describe("The updated title"),caption:fe({raw:b().optional().describe("The updated caption")}).optional().describe("The updated caption"),alt_text:b().optional().describe("The updated alt text (for images)"),description:fe({raw:b().optional().describe("The updated description")}).optional().describe("The updated description"),isWGetMediaById:Y().optional().describe("Whether the tool has been called before to get media details")},annotations:{title:"Update Media"}},async({id:t,...n})=>{var r;if(!n.isWGetMediaById)throw new Error("wp-get-media-by-id tool must be called before updating media call it and return to this tool");try{const i=(await B(`/wp/v2/media/${t}`,"PUT",n)).data;return{content:[{type:"text",text:`Media "${((r=i.title)==null?void 0:r.rendered)||"Untitled"}" (ID: ${i.id}) updated successfully.`}]}}catch(o){throw console.error("[WordPress Media Server] wp-update-media error:",o),new Error(`Error updating media ${t}: ${o.message}`)}}),e.registerTool("wp-delete-medias",{description:"Removes media items from the WordPress library. Use this tool when you need to delete unwanted images or files. Supports bulk deletion of multiple media items. Returns confirmation with results for each media item processed.",inputSchema:{ids:te(M()).describe("The IDs of the media items to delete"),force:Y().optional().default(!1).describe("Whether to bypass trash and force deletion"),confirmationMessage:b().describe(`A clear explanation of what will be deleted and its impact (this would be shown to the user before deletion to ensure they understand the consequences of this irreversible action). Example: "You're about to permanently delete 5 media files including images and documents. This action cannot be undone and will break any pages or posts that display these files."`)},annotations:{title:"Delete Media",destructiveHint:!0}},async({ids:t,force:n,confirmationMessage:r})=>{console.log("[WordPress Media Server] wp-delete-medias",{ids:t,force:n,confirmationMessage:r}),ns(r,"Media deletion");const o=async i=>{var s;try{const l=(await B(`/wp/v2/media/${i}`,"GET")).data,c=`/wp/v2/media/${i}${n?"?force=1":""}`;return await B(c,"DELETE"),{id:i,success:!0,title:((s=l.title)==null?void 0:s.rendered)||l.alt_text||"Untitled Media",filename:l.source_url?l.source_url.split("/").pop():"unknown",error:null}}catch(a){return console.error(`[WordPress Media Server] wp-delete-media error for ID ${i}:`,a),{id:i,success:!1,title:null,filename:null,error:a.message}}};try{const i=t.map(d=>o(d)),a=(await Promise.allSettled(i)).map(d=>{var p;return d.status==="fulfilled"?d.value:{id:0,success:!1,title:null,filename:null,error:((p=d.reason)==null?void 0:p.message)||"Unknown error"}}),l=a.filter(d=>d.success),c=a.filter(d=>!d.success),u={success:c.length===0,message:c.length===0?`All ${t.length} media items deleted successfully`:`${l.length} of ${t.length} media items deleted successfully, ${c.length} failed`,total_media:t.length,successful_deletions:l.length,failed_deletions:c.length,deleted_media:l.map(d=>({id:d.id,title:d.title,filename:d.filename})),failed_media:c.map(d=>({id:d.id,error:d.error}))};return{content:[{type:"text",text:JSON.stringify(u,null,2)}]}}catch(i){throw console.error("[WordPress Media Server] wp-delete-medias error:",i),new Error(`Error deleting media items: ${i.message}`)}}),e.registerTool("wp-set-featured-image",{description:`Sets or removes the WordPress post featured image from an image URL. Use this tool when the user asks to set a featured image for a post, whether if he is in wordpress admin, elementor, or gutenberg. If the user asks to generate an image which is meant to be a featured image, use the generate-image tool for generation and then use this tool to set the generated image as featured image. Do NOT use for other non-featured images or as a fallback when intention is unclear. Returns confirmation that the featured image was set or removed successfully. `,inputSchema:{postId:M().describe("The ID of the post to update"),imageUrl:b().optional().describe(`The URL of the image to set as featured image (omit to remove featured image). Can be any public image URL or imageRef from ${Da.FETCH_EXTERNAL_IMAGE} - MCP server will handle upload to WordPress media library.`),filename:b().optional().describe("Custom filename for the uploaded image (defaults to extracted from URL)"),title:b().optional().describe("Title for the media library entry (defaults to filename)"),altText:b().optional().describe("Alt text for accessibility (defaults to title)")},annotations:{title:"WP Set Featured Image"}},async({postId:t,imageUrl:n,filename:r,title:o,altText:i})=>{var s,a;console.log("[WordPress Media Server] wp-set-featured-image",{postId:t,imageUrl:n,filename:r});try{if(!n)return{content:[{type:"text",text:`Featured image removed from post "${((s=(await B(`/wp/v2/posts/${t}`,"PUT",{featured_media:0})).data.title)==null?void 0:s.rendered)||"Untitled"}" (ID: ${t}).`}]};const c=(await Ii({imageUrl:n,filename:r,title:o,altText:i})).id;console.log("[WordPress Media Server] Featured image uploaded with ID:",c);const d=(await B(`/wp/v2/posts/${t}`,"PUT",{featured_media:c})).data;return{content:[{type:"text",text:`Featured image (ID: ${c}) set for post "${((a=d.title)==null?void 0:a.rendered)||"Untitled"}" (ID: ${t}).`}]}}catch(l){throw console.error("[WordPress Media Server] wp-set-featured-image error:",l),new Error(`Error setting featured image for post ${t}: ${l.message}`)}}),e.registerTool("wp-set-site-logo",{description:`Sets or removes the WordPress site logo from an image URL. Use this tool when the user asks to set a site logo, company logo, or brand logo for their WordPress site. If the user asks to generate a logo which is meant to be the site logo: 1. Use the generate-image tool for generation with prompt: 'Create a logo for "\${ brandName }" which is a \${ sitePurpose }. Use \${ colorPreferences } color scheme. \${ additionalDetails || '' }' 2. Then use this tool to set the generated image as site logo. Returns confirmation that the site logo was set or removed successfully.`,inputSchema:{imageUrl:b().describe(`The URL of the image to set as site logo (omit to remove site logo). Can be any public image URL or imageRef from ${Da.FETCH_EXTERNAL_IMAGE} - MCP server will handle upload to WordPress media library.`),filename:b().optional().describe("Custom filename for the uploaded image (defaults to extracted from URL)"),title:b().optional().describe('Title for the media library entry (defaults to "Site Logo")'),altText:b().optional().describe('Alt text for accessibility (defaults to "Site Logo")')},annotations:{title:"WP Set Site Logo"}},async({imageUrl:t,filename:n,title:r,altText:o})=>{console.log("[WordPress Media Server] wp-set-site-logo",{imageUrl:t,filename:n});try{const i=await Ii({imageUrl:t,filename:n||"site-logo.png",title:r||"Site Logo",altText:o||"Site Logo"});if(!i||!i.id)throw new Error("Image upload failed.");const s=i.id;return await B("/angie/v1/wp-options","POST",{options:{site_logo:s}}),await doe(s),{content:[{type:"text",text:JSON.stringify({success:!0,message:"Site logo set successfully",id:s},null,2)}]}}catch(i){throw console.error("[WordPress Media Server] wp-set-site-logo error:",i),new Error(`Failed to set site logo: ${i.message}`)}}),Ioe(),wn("upload.php")&&Qt(e,_oe),e}async function Roe(e,t,n,r){try{console.log(`[WordPress Media Server] No results for search term "${e}", fetching last uploaded media`);const o={...t,search:void 0,mediaType:"image",per_page:5,orderby:"date",order:"desc"},i=ir("/wp/v2/media",o),a=(await B(i,"GET")).data;if(Array.isArray(a)&&a.length>0){let l=LL(a);return r&&Array.isArray(l)&&(l=await DL(l,n)),{content:[{type:"text",text:JSON.stringify({searchTerm:e,found:0,fallbackStrategy:"recent_images",fallbackResults:Array.isArray(l)?l.length:1,message:`No images found matching "${e}". Here are the most recent images that might match what you're looking for:`,media:l},null,2)}]}}}catch(o){console.error("[WordPress Media Server] Fallback search failed:",o)}return null}const Aoe=[{title:"Create multiple users",name:"create-multiple-users",description:"Create new users with the role [role name] using this list: [paste emails or upload file]"},{title:"Create new role",name:"create-new-role",description:'Using code, create a new user role called [role name] with capabilities to [describe what they should be able to do, e.g., "edit posts but not publish them" or "manage products but not access settings"]'},{title:"Delete users",name:"delete-users",description:"Delete all users with the role [role name] and reassign their content to [Admin/specific user]"},{title:"Change user role",name:"change-user-role",description:"Change [username or email]'s role to [Admin/Editor/Author/Contributor/Subscriber]"},{title:"Update user email",name:"update-user-email",description:"Change [username]'s email address to [new email]"}],$oe=[{title:"Summarize comments",name:"summarize-comments",description:"Summarize all comments on [post title or 'recent posts'] and highlight key themes"},{title:"Flag comments for review",name:"flag-comments",description:"Show me comments on [post title or 'all posts'] that need my attention or response"},{title:"Suggest comment responses",name:"suggest-comment-responses",description:"Write draft replies for comments on [post title] for me to review before posting"}];function Ooe(){const e=new mt({name:"wp-users-server",version:"1.0.0",title:"WP Users"},{instructions:`## WordPress User & Comment Management ### Capabilities: **User Management:** - Create new users with various roles - Assign user roles: - Administrator - Editor - Author - Contributor - Subscriber - Custom roles - Provide documentation about role permissions **User Profile Updates:** - Update first name and last name - Change nicknames - Modify display names - Update email addresses - Update biographical information (bio/description) - Update website URLs - Change user's language preferences (locale) - Update user slugs for URLs - Manage custom user meta fields - Change user roles - Delete users **Comment Management:** - Enable/disable comments on posts - Create new comments - Reply to existing comments - Translate comment text - Modify comment content - Provide comment insights: - Count total comments - Identify comments needing attention - Moderate spam/inappropriate comments ### Limitations: **User Account Management:** - Cannot reset, resend, or set passwords - Cannot send password reset emails - Cannot manage two-factor authentication **User Settings:** - Cannot modify admin color schemes **Advanced Features:** - Cannot enable Angie features for specific users - Cannot generate API keys or application passwords - Cannot add billing/shipping addresses - Cannot manage user capabilities beyond role assignment - Cannot create custom user roles - Cannot manage user sessions or logout users`,capabilities:{resources:{subscribe:!0}}});return e.registerTool("wp-get-users",{description:"Retrieves a list of WordPress users with optional filtering. Use this tool when you need to browse or search for users on the site. Returns an array of user objects with their profiles and metadata, including pagination information.",inputSchema:{search:b().optional().describe("Search term for users"),role:b().optional().describe("User role to filter by"),page:M().optional().describe("Page number"),per_page:M().optional().describe("Number of users per page"),orderby:ve(["id","name","registered_date","email"]).optional().describe("Order users by"),order:ve(["asc","desc"]).optional().describe("Order direction")},annotations:{title:"Get Users",[Ee]:!0}},async t=>{console.log("[WordPress Users Server] wp-get-users",t);try{const n=ir("/wp/v2/users",t),o=(await B(n,"GET")).data;if(!o||Array.isArray(o.data)&&o.data.length===0&&o.totalItems!==0)throw new Error("Invalid response structure from users API");return o.totalItems!==void 0?{content:[{type:"text",text:JSON.stringify({success:!0,users:o.data||o,message:`Total users: ${o.totalItems} across ${o.totalPages||1} pages`,totalItems:o.totalItems,totalPages:o.totalPages||1,currentPage:o.page||1,fetchedAllPages:!t.page},null,2)}]}:{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}catch(n){throw console.error("[WordPress Users Server] wp-get-users error:",n),new Error(`Error retrieving users: ${n.message}`)}}),e.registerTool("wp-create-user",{description:"Creates a new WordPress user account with comprehensive profile information. Use this tool when you need to add a new user to the site with specific roles, credentials, and complete profile details including bio and website. Returns the newly created user object with its assigned ID.",inputSchema:{username:b().describe("The username for the new user"),email:b().email().describe("The email address for the new user"),password:b().describe("The password for the new user"),name:b().optional().describe("The display name for the new user"),first_name:b().optional().describe("The first name for the new user"),last_name:b().optional().describe("The last name for the new user"),description:b().optional().describe("The biographical info/bio for the new user"),url:b().url().optional().describe("The website URL for the new user"),nickname:b().optional().describe("The nickname for the new user"),slug:b().optional().describe("The user slug for URLs (auto-generated if not provided)"),locale:b().optional().describe("The locale/language preference for the new user (e.g., en_US, fr_FR)"),roles:te(b().toLowerCase()).optional().describe("The roles to assign to the new user"),meta:sn(ie([b(),M(),Y()])).optional().describe("Custom user meta fields as key-value pairs for extended user profile information (string, number, or boolean values)")},annotations:{title:"Create User"}},async t=>{console.log("[WordPress Users Server] wp-create-user",{...t,password:"[REDACTED]"});try{const r=(await B("/wp/v2/users","POST",t)).data;if(!r||!r.id)throw new Error("User creation failed.");return await uoe(r.id),{content:[{type:"text",text:JSON.stringify({success:!0,message:`User "${r.name}" created successfully`,userId:r.id,username:r.username,email:r.email,roles:r.roles||[],nextStep:"The user can now log in with their credentials. Consider assigning appropriate roles or adding them to specific posts."},null,2)}]}}catch(n){console.error("[WordPress Users Server] wp-create-user error:",n);const r=n.message;throw new Error(`Error creating user: ${r}. Please verify all required fields (username, email, password) are provided and valid.`)}}),e.registerTool("wp-update-user",{description:"Modifies an existing WordPress user account with comprehensive profile updates. Use this tool when you need to update a user's profile information, email, bio, website, roles, or any other profile fields. Returns confirmation that the user was updated successfully.",inputSchema:{id:M().describe("The ID of the user to update"),email:b().email().optional().describe("The updated email address"),name:b().optional().describe("The updated display name"),first_name:b().optional().describe("The updated first name"),last_name:b().optional().describe("The updated last name"),description:b().optional().describe("The updated biographical info/bio"),url:b().url().optional().describe("The updated website URL"),nickname:b().optional().describe("The updated nickname"),slug:b().optional().describe("The updated user slug for URLs"),locale:b().optional().describe("The updated locale/language preference (e.g., en_US, fr_FR)"),roles:te(b().toLowerCase()).optional().describe("The updated roles"),meta:sn(ie([b(),M(),Y()])).optional().describe("Updated custom user meta fields as key-value pairs (string, number, or boolean values)")},annotations:{title:"Update User"}},async({id:t,...n})=>{const r={...n};"password"in r&&(r.password="[REDACTED]"),console.log("[WordPress Users Server] wp-update-user",{id:t,...r});try{if((await B("/wp/v2/users/me","GET")).data.id===t&&n.roles)throw new Error("Cannot change your own role. Users cannot modify their own role permissions.");const a=(await B(`/wp/v2/users/${t}`,"PUT",n)).data;return{content:[{type:"text",text:`User "${a.name}" (ID: ${a.id}) updated successfully.`}]}}catch(o){throw console.error("[WordPress Users Server] wp-update-user error:",o),new Error(`Error updating user ${t}: ${o.message}`)}}),e.registerTool("wp-get-comments",{description:"Retrieves WordPress comments with optional filtering. Use this tool when you need to browse or search for comments on posts. Returns an array of comment objects with their content and metadata.",inputSchema:aoe.shape,annotations:{title:"Get Comments",[Ee]:!0}},async t=>{console.log("[WordPress Users Server] wp-get-comments",t);try{const n=ir("/wp/v2/comments",t),o=(await B(n,"GET")).data;return{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}catch(n){throw console.error("[WordPress Users Server] wp-get-comments error:",n),new Error(`Error retrieving comments: ${n.message}`)}}),e.registerTool("wp-create-comment",{description:"Creates a new comment on a WordPress post. Use this tool when you need to programmatically add feedback or responses to content. Returns the newly created comment object with its assigned ID.",inputSchema:{post:M().describe("The post ID to add the comment to"),content:b().describe("The comment content"),author:M().optional().describe("The author ID (if authenticated)"),authorName:b().optional().describe("The author name (if not authenticated)"),authorEmail:b().email().optional().describe("The author email (if not authenticated)"),authorUrl:b().url().optional().describe("The author URL (if not authenticated)"),parent:M().optional().describe("The parent comment ID (for replies)")},annotations:{title:"Create Comment"}},async t=>{console.log("[WordPress Users Server] wp-create-comment",t);try{return{content:[{type:"text",text:`Comment created successfully. ID: ${(await B("/wp/v2/comments","POST",t)).data.id}`}]}}catch(n){throw console.error("[WordPress Users Server] wp-create-comment error:",n),new Error(`Error creating comment: ${n.message}`)}}),e.registerTool("wp-update-comment",{description:"Modifies an existing WordPress comment. Use this tool when you need to edit comment content or change its approval status. Returns confirmation that the comment was updated successfully.",inputSchema:{id:M().describe("The ID of the comment to update"),content:b().optional().describe("The updated comment content"),status:ve(["approved","hold","spam","trash"]).optional().describe("The updated comment status")},annotations:{title:"Update Comment"}},async({id:t,...n})=>{console.log("[WordPress Users Server] wp-update-comment",{id:t,...n});try{return{content:[{type:"text",text:`Comment ID: ${(await B(`/wp/v2/comments/${t}`,"PUT",n)).data.id} updated successfully.`}]}}catch(r){throw console.error("[WordPress Users Server] wp-update-comment error:",r),new Error(`Error updating comment ${t}: ${r.message}`)}}),e.registerTool("wp-delete-comments",{description:"Removes WordPress comments from posts. Use this tool when you need to delete inappropriate or spam comments. Supports bulk deletion of multiple comments. Returns confirmation with results for each comment processed.",inputSchema:{ids:te(M()).describe("The IDs of the comments to delete"),force:Y().optional().default(!1).describe("Whether to bypass trash and force deletion"),confirmationMessage:b().describe(`A clear explanation of what will be deleted and its impact (this would be shown to the user before deletion to ensure they understand the consequences of this irreversible action). Example: "You're about to permanently delete 3 comments. This action cannot be undone and will remove these comments from the discussion threads."`)},annotations:{title:"Delete Comments",destructiveHint:!0}},async({ids:t,force:n})=>{console.log("[WordPress Users Server] wp-delete-comments",{ids:t,force:n});const r=async o=>{try{const s=(await B(`/wp/v2/comments/${o}`,"GET")).data,a=`/wp/v2/comments/${o}${n?"&force=true":""}`;return await B(a,"DELETE"),{id:o,success:!0,author_name:s.author_name||"Unknown",error:null}}catch(i){return console.error(`[WordPress Users Server] wp-delete-comment error for ID ${o}:`,i),{id:o,success:!1,author_name:null,error:i.message}}};try{const o=t.map(u=>r(u)),s=(await Promise.allSettled(o)).map(u=>{var d;return u.status==="fulfilled"?u.value:{id:0,success:!1,author_name:null,error:((d=u.reason)==null?void 0:d.message)||"Unknown error"}}),a=s.filter(u=>u.success),l=s.filter(u=>!u.success),c={success:l.length===0,message:l.length===0?`All ${t.length} comments deleted successfully`:`${a.length} of ${t.length} comments deleted successfully, ${l.length} failed`,total_comments:t.length,successful_deletions:a.length,failed_deletions:l.length,deleted_comments:a.map(u=>({id:u.id,author_name:u.author_name})),failed_comments:l.map(u=>({id:u.id,error:u.error}))};return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}catch(o){throw console.error("[WordPress Users Server] wp-delete-comments error:",o),new Error(`Error deleting comments: ${o.message}`)}}),e.registerTool("wp-delete-users",{description:"Permanently removes WordPress user accounts from the site. Use this tool when you need to delete user accounts that are no longer needed. Supports bulk deletion of multiple users. This action will remove the users and optionally reassign their content to another user. Returns confirmation with results for each user processed.",inputSchema:{ids:te(M()).describe("The IDs of the users to delete"),reassign:M().nullable().describe("The ID of the user to reassign content to (optional, applies to all deleted users)"),confirmationMessage:b().optional().describe(`A clear explanation of what will be deleted and its impact (this would be shown to the user before proceeding to ensure they understand the consequences of this action). Example: "You're about to permanently delete 3 user accounts. This action cannot be undone and will remove their accounts and all associated data."`)},annotations:{title:"Delete Users",destructiveHint:!0}},async({ids:t,reassign:n})=>{console.log("[WordPress Users Server] wp-delete-users",{ids:t,reassign:n});const r=async o=>{try{if((await B("/wp/v2/users/me","GET")).data.id===o)return{id:o,success:!1,username:"current-user",error:"Cannot delete current user. You cannot delete your own account while logged in."};const l=(await B(`/wp/v2/users/${o}`,"GET")).data,u=`/wp/v2/users/${o}?reassign=${n!==null?n:!1}&force=true`;return await B(u,"DELETE"),{id:o,success:!0,username:l.username||l.name||"Unknown",error:null}}catch(i){console.error(`[WordPress Users Server] wp-delete-user error for ID ${o}:`,i);let s=i.message??"";return s.includes("rest_user_invalid_id")&&(s=`User with ID ${o} does not exist or was already deleted`),{id:o,success:!1,username:null,error:s}}};try{const o=t.map(u=>r(u)),s=(await Promise.allSettled(o)).map(u=>{var d;return u.status==="fulfilled"?u.value:{id:0,success:!1,username:null,error:((d=u.reason)==null?void 0:d.message)||"Unknown error"}}),a=s.filter(u=>u.success),l=s.filter(u=>!u.success),c={success:l.length===0,message:l.length===0?`All ${t.length} users deleted successfully`:`${a.length} of ${t.length} users deleted successfully, ${l.length} failed`,total_users:t.length,successful_deletions:a.length,failed_deletions:l.length,reassign_user_id:n,deleted_users:a.map(u=>({id:u.id,username:u.username})),failed_users:l.map(u=>({id:u.id,error:u.error}))};return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}catch(o){throw console.error("[WordPress Users Server] wp-delete-users error:",o),new Error(`Error deleting users: ${o.message}`)}}),wn("users.php")&&Qt(e,Aoe),wn("edit-comments.php")&&Qt(e,$oe),e}const Noe=[{title:"Customize Admin dashboard",name:"customize-admin-dashboard",description:`Add a custom dashboard widget that shows [e.g., "today's sales summary" or "pending reviews" or "site health checklist"]`},{title:"Customize login page",name:"customize-login-page",description:"Customize my WordPress login page with my site logo and set the background color to [color]"},{title:"Change site language",name:"change-site-language",description:"Change site language to [language]"},{title:"Change site title",name:"change-site-title",description:"Change site title to [new title]"},{title:"Control search visibility",name:"control-search-visibility",description:"Set search engine visibility to [allow/discourage indexing]"}];function Loe(){const e=new mt({name:"wp-admin-server",version:"1.0.0",title:"Settings"},{instructions:`## WordPress Settings Management ### Capabilities: **General Settings:** - Modify site title and tagline - Update site icon (favicon) - Change administration email address - Configure membership settings (user registration) - Set default role for new users - Change site language - Update timezone settings - Locate the homepage **Content Settings:** - Set default post category - Configure default post format - Adjust reading settings (posts per page) - Control search engine visibility **Discussion Settings:** - Configure comment settings - Set maximum comment rating - Basic comment moderation options **Media Settings:** - Update media upload settings - Configure image size options **Permalink Settings:** - Modify permalink structure - Set custom URL structures **HomePage Settings:** - The front page field is the home page settings which will either contain the latest posts or in case of static - display a specific page - There is also a field for posts page which is the page that will display the posts index - You can only fetch the settings but not update them ### Limitations: - **Email configuration**: Cannot set up "Post via email" features - **Homepage settings**: Cannot set static homepage or posts page - **Comment moderation**: Cannot configure detailed comment moderation rules or disallowed keywords - **Privacy settings**: Cannot change or set the Privacy Policy page - **Advanced settings**: Cannot access many advanced WordPress configurations - **Multisite settings**: Cannot manage network-wide settings - **Database settings**: Cannot modify database configurations - **Debug settings**: Cannot enable/disable debug mode`,capabilities:{resources:{subscribe:!0}}});return e.registerTool("wp-get-settings",{description:"Retrieves WordPress site settings. Use this tool when you need to access configuration values like site title, description, timezone, etc. Returns all available site settings in a single response.",inputSchema:{},annotations:{title:"Get Settings",[Ee]:!0}},async()=>{try{const n=(await B("/angie/v1/wp-options","GET")).data;return{content:[{type:"text",text:JSON.stringify({settings:n},null,2)}]}}catch(t){throw console.error("[WordPress Admin Server] wp-get-settings error:",t),t}}),e.registerTool("wp-update-settings",{description:"Updates WordPress site settings across all admin categories. Use this tool when you need to modify any configuration accessible through the WordPress Settings tab, including general site settings (title, tagline, admin email), reading settings (posts per page, RSS settings), discussion settings (comments, pingbacks), media settings (image sizes, upload organization), permalink structure, user registration settings, and privacy options. This tool can update multiple settings simultaneously in a single operation. Returns confirmation of successful updates.",inputSchema:{...ioe.shape,confirmationMessage:b().describe(`REQUIRED: Provide a clear explanation of what site settings will be changed and their potential impact. This message will be shown to the user before proceeding to ensure they understand the consequences of this action. Be specific about which settings are being modified and how they will affect the site. Examples: "You're about to change the site language to Spanish. This will affect how the admin dashboard and front-end appear for all users." or "You're about to change the site title to 'My New Site' and update the tagline. This will be visible across your entire website."`)},annotations:{title:"Update Site Settings",destructiveHint:!0}},async({confirmationMessage:t,...n})=>{console.log("[WordPress Admin Server] wp-update-settings",{settings:n,confirmationMessage:t});try{return ns(t,"Site settings"),n.WPLANG==="en_US"&&(n.WPLANG=""),await B("/angie/v1/wp-options","POST",{options:n}),{content:[{type:"text",text:"Site settings updated successfully."}]}}catch(r){throw console.error("[WordPress Admin Server] wp-update-settings error:",r),r}}),e.registerTool("wp-get-site-health",{description:"Retrieves WordPress Site Health Status information from Tools > Site Health. This tool provides a comprehensive health check of the WordPress installation, identifying critical issues that may impact performance or security, recommended improvements for better site operation, and passed tests. Use this when you need to diagnose site problems, check for security vulnerabilities, verify proper WordPress configuration, or get an overall health score. The tool returns categorized issues with their severity levels (critical/recommended), affected areas (Performance/Security), and detailed descriptions of each problem.",inputSchema:{},annotations:{title:"Get Site Health",[Ee]:!0}},async()=>{console.log("[WordPress Admin Server] wp-get-site-health");try{const n=(await B("/angie/v1/wp-options/health","GET")).data;return{content:[{type:"text",text:JSON.stringify(n,null,2)}]}}catch(t){throw console.error("[WordPress Admin Server] wp-get-site-health error:",t),t}}),wn("options-general.php")&&Qt(e,Noe),e}const Moe=[{title:"Rollback theme",name:"rollback-theme",description:"Using code, add a rollback button to my themes and plugins so I can revert back and forth to previous and current version"},{title:"Create child theme",name:"create-child-theme",description:'Using code, add a "Create Child Theme" button to the themes page that automatically generates a child theme from any installed theme with one click'},{title:"Install theme",name:"install-theme",description:"Install the [theme name]"},{title:"Update theme",name:"update-theme",description:"Update the theme [theme name] to the latest version"},{title:"Activate theme",name:"activate-theme",description:"Activate the [theme name]"},{title:"Switch theme",name:"switch-theme",description:"Switch my active theme to [theme name]"},{title:"Update all themes",name:"update-all-themes",description:"Update all installed themes"},{title:"Delete theme",name:"delete-theme",description:"Delete the [theme name]"},{title:"Suggest themes",name:"suggest-themes",description:"Suggest themes for a [type of website] with [specific features]"}];function Doe(){const e=new mt({name:"theme-installation-server",version:"1.0.0",title:"WP Theme"},{instructions:`## WordPress Theme Management ### Capabilities: **Theme Discovery:** - Search for themes in the WordPress repository - Suggest relevant themes based on needs - Filter themes by features and style **Theme Management:** - Install new themes from the repository - Activate themes (set as active theme) - Update themes to latest versions - Delete inactive themes **Theme Information:** - List all installed themes - Show current active theme - Display theme details and features - Check theme compatibility ### Limitations: - **Version control**: Cannot rollback themes to previous versions - **Theme editor**: Cannot access or edit theme files (cannot customize the appearance of the website using the block editor or theme customization tools) - **Customizer**: Cannot access WordPress Customizer settings - **Child themes**: Cannot create or manage child themes - **Premium themes**: Cannot install premium/paid themes - **Direct uploads**: Cannot install themes from uploaded files - **Theme options**: Cannot configure theme-specific settings - **Live preview**: Cannot preview themes before activation`,capabilities:{resources:{subscribe:!0}}});return e.registerTool("wp-get-themes",{description:"Retrieves a list of WordPress themes with optional filtering. Use this tool when you need to see what themes are available or active on the site.",inputSchema:loe.shape,annotations:{title:"WP Get Themes",[Ee]:!0}},async t=>{console.log("[Theme Installation Server] wp-get-themes",t);try{const n=ir("/wp/v2/themes",t),o=(await B(n,"GET")).data;return{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}catch(n){throw console.error("[Theme Installation Server] wp-get-themes error:",n),new Error(`Error retrieving themes: ${n.message}`)}}),e.registerTool("wp-get-theme",{description:"Fetches a specific WordPress theme by its stylesheet name. Use this tool when you need complete details about a single theme. Returns a single theme object with its full details and status.",inputSchema:{stylesheet:b().describe("The stylesheet name of the theme to retrieve")},annotations:{title:"WP Get Theme",[Ee]:!0}},async({stylesheet:t})=>{console.log("[Theme Installation Server] wp-get-theme",{stylesheet:t});try{const r=(await B(`/wp/v2/themes/${t}`,"GET")).data;return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}catch(n){throw console.error("[Theme Installation Server] wp-get-theme error:",n),new Error(`Error retrieving theme ${t}: ${n.message}`)}}),e.registerTool("wp-search-themes",{description:"Searches the WordPress.org theme repository for themes. Use this tool when you need to find themes that are available for installation. Returns a list of themes matching the search criteria.",inputSchema:{search:b().describe("Search term to filter themes by name"),page:M().optional().describe("Page number of the collection"),per_page:M().optional().describe("Number of themes to return per page")},annotations:{title:"WP Search Themes",[Ee]:!0}},async t=>{console.log("[Theme Installation Server] wp-search-themes",t);try{const n=ir("/angie/v1/themes/search",t),o=(await B(n,"GET")).data;return{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}catch(n){throw console.error("[Theme Installation Server] wp-search-themes error:",n),new Error(`Error searching themes: ${n.message}`)}}),e.registerTool("wp-get-theme-info",{description:"Fetches information about a theme from WordPress.org. Use this tool when you need details about a theme before installing it. Returns comprehensive information about the theme.",inputSchema:{slug:b().describe("The slug of the theme to get information about")},annotations:{title:"WP Get Theme Info",[Ee]:!0}},async({slug:t})=>{console.log("[Theme Installation Server] wp-get-theme-info",{slug:t});try{const r=(await B(`/angie/v1/themes/info/${t}`,"GET")).data;return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}catch(n){throw console.error("[Theme Installation Server] wp-get-theme-info error:",n),new Error(`Error getting theme info for ${t}: ${n.message}`)}}),e.registerTool("wp-get-theme-update-info",{description:"Fetches information about available updates for any installed theme. Use this tool when you need to see if a given theme has any updates available. If no slug is provided, it will return information about all installed themes.",inputSchema:{slug:b().optional().describe("The slug of the theme to get update information about")},annotations:{title:"WP Get Theme Update Info",[Ee]:!0}},async({slug:t})=>{console.log("[Theme Installation Server] wp-get-theme-update-info",{slug:t});try{const r=(await B("/angie/v1/themes/update-info","GET",{slug:t})).data;return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}catch(n){throw console.error("[Theme Installation Server] wp-get-theme-update-info error:",n),new Error(`Error getting theme update info for ${t}: ${n.message}`)}}),e.registerTool("wp-install-theme",{description:"Installs a WordPress theme from the WordPress.org theme directory or a provided ZIP URL. Use this tool when you need to add a new theme to the site. Returns confirmation of the installed theme with its details.",inputSchema:{slug:b().describe("The slug of the theme to install from WordPress.org")},annotations:{title:"WP Install Theme"}},async({slug:t})=>{console.log("[Theme Installation Server] wp-install-theme",{slug:t});try{return{content:[{type:"text",text:`Theme "${(await B("/angie/v1/themes/install","POST",{slug:t})).data.name||t}" installed successfully.`}]}}catch(n){throw console.error("[Theme Installation Server] wp-install-theme error:",n),new Error(`Error installing theme: ${n.message}`)}}),e.registerTool("wp-activate-theme",{description:"Activates an installed WordPress theme. Use this tool when you need to switch the active theme on the site. Returns confirmation that the theme was activated successfully.",inputSchema:{stylesheet:b().describe("The stylesheet name of the theme to activate")},annotations:{title:"WP Activate Theme"}},async({stylesheet:t})=>{console.log("[Theme Installation Server] wp-activate-theme",{stylesheet:t});try{return{content:[{type:"text",text:`Theme "${(await B("/angie/v1/themes/activate","POST",{stylesheet:t})).data.name||t}" activated successfully.`}]}}catch(n){throw console.error("[Theme Installation Server] wp-activate-theme error:",n),new Error(`Error activating theme ${t}: ${n.message}`)}}),e.registerTool("wp-deactivate-theme",{description:"Deactivates the current theme and switches to the default theme. Use this tool when you need to reset the active theme. Returns confirmation that the theme was deactivated successfully.",inputSchema:{},annotations:{title:"WP Deactivate Theme"}},async()=>{console.log("[Theme Installation Server] wp-deactivate-theme");try{return await B("/angie/v1/themes/deactivate","POST"),{content:[{type:"text",text:"Current theme deactivated successfully. Switched to default theme."}]}}catch(t){throw console.error("[Theme Installation Server] wp-deactivate-theme error:",t),new Error(`Error deactivating theme: ${t.message}`)}}),e.registerTool("wp-update-theme",{description:"Updates an installed WordPress theme. Use this tool when you need to update a theme to the latest version. Returns confirmation that the theme was updated successfully.",inputSchema:{themes:te(b()).describe("The slugs of the themes to update"),confirmationMessage:b().describe(`A clear explanation of what will be updated and its potential impact (this would be shown to the user before proceeding to ensure they understand the consequences of this action). Example: "You're about to update the 'Astra' theme to the latest version. This action may change your site's appearance or functionality and could potentially break custom modifications."`)},annotations:{title:"WP Update Theme",destructiveHint:!0}},async({themes:t})=>{console.log("[Theme Installation Server] wp-update-theme",{themes:t});try{const r=(await B("/angie/v1/themes/update","POST",{themes:t})).data;return console.log("[Theme Installation Server] wp-update-theme result",r),{content:[{type:"text",text:JSON.stringify(r)}]}}catch(n){throw console.error("[Theme Installation Server] wp-update-theme error:",n),new Error(`Error updating theme(s): ${n.message}`)}}),e.registerTool("wp-delete-themes",{description:"Deletes installed WordPress themes. Use this tool when you need to remove themes from the site. Supports bulk deletion of multiple themes. Returns confirmation with results for each theme processed.",inputSchema:{stylesheets:te(b()).describe("The stylesheet names of the themes to delete"),confirmationMessage:b().optional().describe(`A clear explanation of what will be deleted and its potential impact (this would be shown to the user before proceeding to ensure they understand the consequences of this action). Example: "You're about to delete 3 themes permanently. This action cannot be undone and will remove all theme files from your site."`)},annotations:{title:"WP Delete Theme",destructiveHint:!0}},async({stylesheets:t})=>{console.log("[Theme Installation Server] wp-delete-themes",{stylesheets:t});const n=async r=>{var o;try{const s=(await B(`/wp/v2/themes/${r}`,"GET")).data;return await B("/angie/v1/themes/delete","POST",{stylesheet:r}),{stylesheet:r,success:!0,name:((o=s.name)==null?void 0:o.rendered)||s.name||r,error:null}}catch(i){return console.error(`[Theme Installation Server] wp-delete-theme error for ${r}:`,i),{stylesheet:r,success:!1,name:null,error:i.message}}};try{const r=t.map(c=>n(c)),i=(await Promise.allSettled(r)).map(c=>{var u;return c.status==="fulfilled"?c.value:{stylesheet:"unknown",success:!1,name:null,error:((u=c.reason)==null?void 0:u.message)||"Unknown error"}}),s=i.filter(c=>c.success),a=i.filter(c=>!c.success),l={success:a.length===0,message:a.length===0?`All ${t.length} themes deleted successfully`:`${s.length} of ${t.length} themes deleted successfully, ${a.length} failed`,total_themes:t.length,successful_deletions:s.length,failed_deletions:a.length,deleted_themes:s.map(c=>({stylesheet:c.stylesheet,name:c.name})),failed_themes:a.map(c=>({stylesheet:c.stylesheet,error:c.error}))};return{content:[{type:"text",text:JSON.stringify(l,null,2)}]}}catch(r){throw console.error("[Theme Installation Server] wp-delete-themes error:",r),new Error(`Error deleting themes: ${r.message}`)}}),wn("themes.php")&&Qt(e,Moe),e}const Uoe=[{title:"Install plugin",name:"install-plugin",description:"Install the [plugin name] plugin"},{title:"Update all plugins",name:"update-all-plugins",description:"Update all plugins to their latest version"},{title:"Deactivate plugins",name:"deactivate-plugins",description:"Deactivate these plugins: [plugin names]"},{title:"Suggest plugins",name:"suggest-plugins",description:"Suggest plugins for [specific need or feature]"},{title:"Delete inactive plugins",name:"delete-inactive-plugins",description:"Delete all currently inactive plugins"},{title:"Rollback plugins",name:"rollback-plugins",description:"Using code, add a rollback button to my themes and plugins so I can revert back and forth to previous and current version"}],joe="wp-plugins-list-installed",mg="wp://plugins/list-installed",Woe="wp-plugins-search",kS="wp://plugins/search/{searchTerm}";function Foe(){const e=new mt({name:"plugin-installation-server",version:"1.0.0",title:"WP Plugin"},{instructions:`## WordPress Plugin Management ### Capabilities: **Plugin Discovery:** - Search for plugins in the WordPress repository - Suggest relevant plugins based on specific needs - Provide plugin recommendations for functionality requirements **Plugin Management:** - Install new plugins from the repository - Activate installed plugins - Deactivate active plugins - Delete plugins (when deactivated) - Perform bulk operations (up to 10 plugins at once) **Plugin Information:** - List all installed plugins - Show plugin status (active/inactive) - Display plugin details and descriptions - Check compatibility information ### Limitations: - **Version control**: Cannot rollback plugins to previous versions - **Update management**: Cannot enable/disable automatic updates - **Premium plugins**: Cannot install premium/paid plugins - **Direct uploads**: Cannot install plugins from uploaded files - **Plugin editor**: Cannot edit plugin code - **Multisite management**: Cannot network activate/deactivate plugins - **Dependency management**: Cannot automatically resolve plugin conflicts - **License management**: Cannot manage premium plugin licenses`,capabilities:{resources:{subscribe:!0}}});return e.resource(joe,mg,{title:"WP Installed Plugins",description:"Complete list of all installed WordPress plugins with their identifiers, basenames, activation status, version information, and metadata"},async()=>{const t=await UL({});return{contents:[{uri:mg,mimeType:"application/json",text:t.content[0].text}]}}),e.resource(Woe,new Xr(kS,{list:void 0}),{title:"WP Plugin Search",description:"Search results from the WordPress.org plugin repository for a given search term, returning a map of plugin names to their slugs"},async(t,n)=>{const r=Array.isArray(n.searchTerm)?n.searchTerm[0]:n.searchTerm;if(!r)throw new Error("Search term is required");let o=r;try{o=decodeURIComponent(r)}catch{console.error("unable to decode search term, using raw value")}const s=(await jL({searchFilters:{search:o,per_page:10}})).content[0].text;let a={};try{a=JSON.parse(s).plugins.reduce((c,u)=>(c[u.name]=u.slug,c),{})}catch(l){console.error("Error parsing plugins JSON:",l)}return{contents:[{uri:t.toString(),mimeType:"application/json",text:Object.keys(a).length?JSON.stringify(a,null,2):s}]}}),e.registerTool("plugins",{description:`This tool manages WordPress plugins through search, installation, activation, updates, and removal Use this when you need to add new functionality to a site, enable/disable plugin features, or maintain plugin versions Note: - Unless the user explicitly request the installation, call the suggest-plugins tool to get recommendations before installing plugins - Before installing a plugin, You must include a confirmation message explaining the impact of the installation to the user - Newly installed plugins require activation to become functional`,inputSchema:{action:ve(["list","get","install","get-update-info","update","activate","deactivate","delete","search"]).describe('Specific operation to perform: "list" (retrieve all plugins), "get" (fetch single plugin details), "search" (find plugins in WordPress.org repository), "install" (add new plugin - starts inactive), "activate"/"deactivate" (change plugin state), "update" (upgrade to latest version), "delete" (permanently remove), "get-update-info" (check available updates)'),plugins:te(b()).optional().describe(`Plugin identifiers required for get/install/activate/deactivate/delete/update actions. For installed plugin operations, use the exact basename from the ${mg} resource (e.g. "send-app/send-app", "woocommerce/woocommerce"). For install action, after calling suggest-plugins tool and reading ${kS} resource, provide just the slug (e.g. "woocommerce")`),listFilters:fe({status:ve(["active","inactive"]).optional().describe("Filter by activation state to find only enabled or disabled plugins"),search:b().optional().describe("Text search to find plugins by name or description keywords"),per_page:M().optional().describe("Limit results for pagination (default varies by WordPress configuration)"),page:M().optional().describe("Page number for paginated results when per_page is set")}).optional().describe('Optional filtering criteria used only with "list" action to narrow down plugin results'),searchFilters:fe({search:b().describe("Search term to find plugins in WordPress.org repository by name, description, or author. The term must be according to the relevant plugin recommendations and the user intent."),per_page:M().optional().describe("Number of results per page (default 10)"),page:M().optional().describe("Page number for paginated search results")}).optional().describe('Search criteria required for "search" action to discover plugins in WordPress.org repository before installation'),confirmationMessage:b().optional().describe(`For "delete" or "install" actions provide a clear explanation of what will be deleted and its impact (this would be shown to the user before proceeding to ensure they understand the consequences of this action). Example: "You're about to permanently delete the 'Contact Form 7' plugin. This action cannot be undone and will remove all plugin files and data from your site."`),isExplicitInstallRequest:Y().default(!1).describe("Set to true if the install action is directly requested by the user, false otherwise. Default is false"),wasSuggestPluginsCalled:Y().default(!1).describe("Set to true if the suggest-plugins tool was called prior to installation, false otherwise. Default is false")},annotations:{title:"WP Plugin Operations",destructiveHint:!0},_meta:{[Ie]:[{uri:mg,whenToUse:"When performing operations on installed plugins (activate, deactivate, delete, get, or get-update-info actions) to get the exact plugin basenames"},{uri:kS,whenToUse:"Needed before installation only if you dont have already the plugin slug",params:{searchTerm:"Free text"}}]}},async t=>{if(console.log("[Plugin Installation Server] plugins",t),t.action==="install"&&!t.isExplicitInstallRequest&&!t.wasSuggestPluginsCalled)throw new Error("LLM Instructions: If the user didn't explicitly request installing the plugin you need to call the suggest plugins tool first ");(t.action==="delete"||t.action==="install")&&ns(t.confirmationMessage,`Plugin ${t.action}`);try{switch(t.action){case"list":return await UL(t);case"get":return await zoe(t);case"search":return await jL(t);case"install":return await Hoe(t);case"update":return await qoe(t);case"activate":return await Voe(t);case"deactivate":return await Koe(t);case"delete":return await Zoe(t);case"get-update-info":return await WL()}}catch(n){throw console.error("[Plugin Installation Server] plugins error:",n),new Error(`Error performing ${t.action} action: ${n.message}`)}}),wn("plugins.php")&&Qt(e,Uoe),e}async function UL(e){const t=ir("/wp/v2/plugins",e.listFilters||{}),r=(await B(t,"GET")).data,o={total_plugins:Array.isArray(r)?r.length:0,active_plugins:Array.isArray(r)?r.filter(i=>i.status==="active").length:0,inactive_plugins:Array.isArray(r)?r.filter(i=>i.status==="inactive").length:0,plugins:r};return Md(o)}async function zoe(e){if(!Array.isArray(e.plugins))throw new Error("Plugins array is required for get action");const t=e.plugins,n=await gg(t),{failed:r,resolvablePlugins:o}=hg(n),i=[];for(const{original:s,resolved:a}of o)try{const c=(await B(`/wp/v2/plugins/${a}`,"GET")).data;i.push({success:!0,plugin:s,data:c})}catch(l){r.push({plugin:s,error:l.message})}return tc("",t.length,i.length,r.length,i,r)}async function jL(e){if(!e.searchFilters)throw new Error("SearchFilters are required for search action");const t=new URLSearchParams;t.append("search",e.searchFilters.search),e.searchFilters.per_page&&t.append("per_page",e.searchFilters.per_page.toString()),e.searchFilters.page&&t.append("page",e.searchFilters.page.toString());const n=`/angie/v1/plugins/search?${t.toString()}`,o=(await B(n,"GET")).data;return{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}function Boe(e){return`${e.split("/")[0]}/${e.split("/")[1]}.php`}function Goe(e){return e.split("/")[0]}async function Hoe(e){if(!Array.isArray(e.plugins))throw new Error("Plugins array is required for install action");const t=e.plugins,n=[],r=[];for(const o of t)try{const i=Goe(o),a=(await B("/wp/v2/plugins","POST",{slug:i})).data;if(!a||typeof a!="object"){r.push({plugin:o,error:"Invalid response from plugin installation API"});continue}const l=a.name||o,c=a.status==="active",u=a.plugin||Boe(o);await Ld(u,"install"),n.push({success:!0,plugin:o,pluginName:l,status:c?"active":"inactive",ready:c,pluginBasename:u,message:c?`Plugin "${l}" installed and activated successfully.`:`Plugin "${l}" installed successfully but is not yet active.`})}catch(i){r.push({plugin:o,error:i.message})}return tc("",t.length,n.length,r.length,n,r)}async function qoe(e){let t;if(!e.plugins||e.plugins.length===0){const o=await WL(!0);if(!o||!o.updates_available||(t=Object.keys(o.updates_available),t.length===0))return FL()}else t=e.plugins;const r=(await B("/angie/v1/plugins/update","POST",{plugins:t.map(o=>o.includes(".php")?o:o+".php")})).data;return console.log("[Plugin Installation Server] wp-update-plugin result",r),Md(r)}async function Voe(e){if(!Array.isArray(e.plugins))throw new Error("Plugins array is required for activate action");const t=e.plugins,n=await gg(t),{failed:r,resolvablePlugins:o}=hg(n),i=[];for(const{original:s,resolved:a}of o)try{const c=(await B(`/wp/v2/plugins/${a}`,"POST",{status:"active"})).data;await Ld(a,"activate");const u=c.name||s;i.push({success:!0,plugin:s,pluginName:u,message:`Plugin "${u}" activated successfully.`})}catch(l){r.push({plugin:s,error:l.message})}return tc("activation",t.length,i.length,r.length,i,r)}async function Koe(e){if(!Array.isArray(e.plugins))throw new Error("Plugins array is required for deactivate action");const t=e.plugins,n=await gg(t),{failed:r,resolvablePlugins:o}=hg(n),i=[];for(const{original:s,resolved:a}of o)try{const c=(await B(`/wp/v2/plugins/${a}`,"POST",{status:"inactive"})).data;await Ld(a,"deactivate");const u=c.name||s;i.push({success:!0,plugin:s,pluginName:u,message:`Plugin "${u}" deactivated successfully.`})}catch(l){r.push({plugin:s,error:l.message})}return tc("deactivation",t.length,i.length,r.length,i,r)}async function Zoe(e){if(!Array.isArray(e.plugins))throw new Error("Plugins array is required for delete action");const t=e.plugins,n=await gg(t),{failed:r,resolvablePlugins:o}=hg(n),i=[];if(o.length===0)return tc("deletion",t.length,i.length,r.length,i,r);for(const{original:s,resolved:a}of o)try{await B(`/wp/v2/plugins/${a}`,"DELETE"),await Ld(a,"delete"),i.push({success:!0,plugin:s,message:`Plugin "${s}" deleted successfully.`,deactivated:!1})}catch(l){const c=l.message;if(c.includes("rest_cannot_delete_active_plugin")){console.log(`[Plugin Delete] Plugin ${s} is active, deactivating first...`);try{await B(`/wp/v2/plugins/${a}`,"POST",{status:"inactive"}),await B(`/wp/v2/plugins/${a}`,"DELETE"),await Ld(a,"delete"),i.push({success:!0,plugin:s,message:`Plugin "${s}" deactivated and deleted successfully.`,deactivated:!0})}catch(u){r.push({plugin:s,error:u.message})}}else r.push({plugin:s,error:c})}return tc("deletion",t.length,i.length,r.length,i,r)}async function WL(e=!1){const n=(await B("/angie/v1/plugins/update-info","GET")).data;return e?n:Md(n)}function FL(){return Md({success:!0,message:"All plugins are up to date. No updates available.",updated_plugins:[],update_count:0})}async function Ld(e,t){try{const r=(await B(`/wp/v2/plugins/${e}`,"GET")).data;switch(t){case"install":if(!r)throw new Error(`Plugin "${e}" was not found after installation`);break;case"activate":if(r.status!=="active")throw new Error(`Plugin "${r.name||e}" is not active after activation attempt. Current status: ${r.status}`);break;case"deactivate":if(r.status!=="inactive")throw new Error(`Plugin "${r.name||e}" is not inactive after deactivation attempt. Current status: ${r.status}`);break;case"delete":throw new Error(`Plugin "${e}" still exists after deletion attempt`)}}catch(n){const r=n.message;if(t==="delete"){if(!r.includes("rest_plugin_not_found"))throw n;return}throw new Error(`Failed to verify plugin action "${t}": ${r}`)}}function hg(e){const t=e.filter(o=>o.resolved),n=e.filter(o=>o.error),r=[];return n.forEach(({original:o,error:i})=>{r.push({plugin:o,error:i})}),{failed:r,resolvablePlugins:t}}function tc(e,t,n,r,o,i){return Md({message:`Processed ${t} plugin(s)${e?` for ${e}`:""}: ${n} successful, ${r} failed`,total:t,successful_count:n,failed_count:r,successes:o,errors:i})}async function gg(e){return Promise.all(e.map(async t=>{try{const n=await B3(t,B);return{original:t,resolved:n}}catch(n){return{original:t,error:n.message}}}))}function Md(e){return{content:[{type:"text",text:typeof e=="string"?e:JSON.stringify(e,null,2)}]}}var xS=(e=>(e.RESIZE_IMAGE="resize-image",e.UPSCALE_IMAGE="upscale-image",e.GENERATE_IMAGE="generate-image",e.CUSTOM_CSS_APPROVAL="custom-css-approval",e.GENERATE_LOGO="generate-logo",e.GENERATE_IMAGE_VARIATIONS="generate-image-variations",e.CONSENT_DIALOG="consent-dialog",e.GENERATE_FEATURED_IMAGE="generate-featured-image",e.MOTION_EFFECTS="motion-effects",e.REMOVE_BACKGROUND="remove-background",e.IMAGE_GALLERY="image-gallery",e.PREVIEW_SITE_GLOBALS="preview-site-globals",e.REPLACE_BACKGROUND="replace-background",e.ISOLATE_OBJECT="isolate-object",e.IMAGE_TOOLS_MODAL="image-tools-modal",e))(xS||{});const zL=50;function CS(e){try{const t=zn();t&&t.contentWindow?t.contentWindow.postMessage({type:ut.ANGIE_NAVIGATE_AFTER_RESPONSE,payload:{url:e}},"https://angie.elementor.com"):setTimeout(()=>{window.location.replace(e)},zL)}catch{setTimeout(()=>{window.location.replace(e)},zL)}}const BL=2,yg=6,GL="wp-admin-navigation-menu",wg="wp://admin/navigation-menu",HL="wp-admin-available-urls",vg="wp://admin/available-urls";let _g=null,qL=0;const Yoe=3e4;async function VL(){const e=Date.now();return _g&&e-qL(t[yg]&&typeof t[yg]=="string"&&t[yg].startsWith("data:image/")&&(t[yg]="[base64-image-filtered]"),t);try{const n=(await B("/angie/v1/menu-items","GET")).data;if(n.menu)for(const[r,o]of Object.entries(n.menu))n.menu[r]=e(o);return n}catch(t){console.warn("Error accessing WordPress menu structure:",t)}return null}function Joe(e){if(!e)return[];const t=[],n=r=>{r[BL]&&t.push(r[BL])};return e.menu&&Object.values(e.menu).forEach(n),e.submenu&&Object.values(e.submenu).flat().forEach(n),t}function ZL(e,t,n){return{contents:[{uri:e.href,mimeType:"application/json",text:JSON.stringify({error:`Error retrieving ${t}: ${n.message}`},null,2)}]}}function Xoe(){const e=new mt({name:"wp-navigation-server",version:"1.0.0",title:"WP Navigation"},{capabilities:{resources:{}}});return e.resource(GL,new Xr(wg,{list:async()=>({resources:[{uri:wg,name:GL,title:"WordPress Admin Navigation Menu",description:"Complete WordPress admin menu structure with all available navigation items",mimeType:"application/json"}]})}),{title:"WordPress Admin Navigation Menu",description:"Complete WordPress admin menu structure with all available navigation items"},async t=>{console.log(`[Navigation Server] Resource accessed: ${wg}`);try{const n=await VL();return{contents:[{uri:t.href,mimeType:"application/json",text:JSON.stringify(n,null,2)}]}}catch(n){return ZL(t,"navigation menu",n)}}),e.resource(HL,new Xr(vg,{list:async()=>({resources:[{uri:vg,name:HL,title:"WordPress Admin Available URLs",description:"List of all accessible admin URLs extracted from the menu structure",mimeType:"application/json"}]})}),{title:"WordPress Admin Available URLs",description:"List of all accessible admin URLs extracted from the menu structure"},async t=>{console.log(`[Navigation Server] Resource accessed: ${vg}`);try{const n=await VL(),r=Joe(n);return{contents:[{uri:t.href,mimeType:"application/json",text:JSON.stringify({availableUrls:r},null,2)}]}}catch(n){return ZL(t,"available URLs",n)}}),e.registerTool("get-navigation-menu-and-urls",{description:`Discover Available WordPress admin menu Navigation Destinations - This tool retrieves the complete WordPress admin menu structure to help determine where users can navigate next. `,inputSchema:{},annotations:{title:"Get WP Admin Navigation Menu and URLs",[Ee]:!0}},async()=>{console.log("[Navigation Server] get-navigation-options");try{const t=await KL();return{content:[{type:"text",text:JSON.stringify(t,null,2)}]}}catch(t){throw console.error("[Navigation Server] get-wp-admin-locations error:",t),new Error(`Error retrieving admin locations: ${t.message}`)}}),e.registerTool("navigate-to-wordpress-destination",{description:`This tool provides instant navigation to any destination, page, editor, or admin area from any current screen at any time. Use this when users ask to "go to...", "navigate to...", "take me to...", or need to access specific WordPress admin pages, edit content, or any WordPress feature. The tool automatically handles unsaved changes by showing a consent dialog before navigation, ensuring no data loss. It works universally across all WordPress admin contexts - whether the user is currently editing a page, viewing the dashboard, managing plugins, or anywhere else in WordPress admin. The tool will redirect the browser to the specified destination and handle the navigation seamlessly. Use this tool to navigate to any wordpress destination. Avoid from guiding users to manually navigate - instead, use this tool to automatically navigate users to their intended WordPress screen.`,inputSchema:{url:b().url().describe('The complete destination URL to navigate to within WordPress admin (e.g., "http://localhost:4444/wp-admin/edit.php"). This must be a full URL with protocol and domain. The URL determines which WordPress admin screen will be loaded. Use the navigation menu resources to get the correct full URLs.'),destinationDescription:b().describe(`A user-friendly description of where the user will be navigated to (e.g., "the posts list", "edit the page", "dashboard"). This will be shown in the consent dialog to help the user understand what they're navigating to. Be descriptive but concise.`)},annotations:{title:"Navigate To WordPress Destination"},_meta:{[Ie]:[{uri:wg,whenToUse:"When navigating to discover available WordPress admin menu items and their URLs"},{uri:vg,whenToUse:"When navigating to get the complete list of valid WordPress admin URLs"}]}},async({url:t,destinationDescription:n})=>{if(console.log("[Navigation Server] navigate-to",{url:t,destinationDescription:n}),!t||typeof t!="string"||!t.startsWith("http"))throw new Error(`Invalid navigation URL: "${t}". The URL must be a complete HTTP/HTTPS URL including protocol and domain.`);t.includes("elementor")&&await q3();try{const r={name:xS.CONSENT_DIALOG,toolName:"navigate-to-wordpress-destination",description:`You are about to navigate to ${n}.`,chipLabel:"Leave Page?",approveButtonLabel:"Leave anyway",rejectButtonLabel:"Stay",toolArgs:[{url:t}]};return(await VI(r)).approved?(CS(t),{content:[{type:"text",text:JSON.stringify({success:!0,message:`Navigation to "${n}" will proceed after the final response is received`,destinationUrl:t,destinationDescription:n,nextStep:"The page will automatically redirect. Any unsaved changes have been handled via the consent dialog."},null,2)}]}):(console.log("[Navigation Server] User cancelled navigation"),{content:[{type:"text",text:JSON.stringify({success:!1,message:"Navigation cancelled by user",cancelled:!0,requestedUrl:t,requestedDestination:n},null,2)}]})}catch(r){throw console.error("[Navigation Server] navigate-to error:",r),new Error(`Error navigating to "${t}": ${r.message}`)}}),e.registerTool("get-current-location",{description:'This tool identifies the current WordPress admin location and context to provide location-aware assistance. Use this when users make contextual requests like "edit this page" or "modify this content" where you need to understand their current location, or when providing help without clear context. The tool returns the current URL, admin page type, and available WordPress context variables to help determine if navigation is needed or if the user is already in the right place.',inputSchema:{},annotations:{title:"Get Current WP Admin Location",[Ee]:!0}},async()=>{console.log("[Navigation Server] get-current-location");try{const t={currentUrl:window.location.href,pathname:window.location.pathname,search:window.location.search};return{content:[{type:"text",text:JSON.stringify(t,null,2)}]}}catch(t){throw console.error("[Navigation Server] get-current-location error:",t),new Error(`Error getting current location: ${t.message}`)}}),e}const Qoe=[{title:"Create new menu",name:"create-new-menu",description:"Create a new menu called [menu name] with the following pages [pages titles]"},{title:"Auto-populate menu",name:"auto-populate-menu",description:"Automatically add all pages in [parent page or category] to the [menu name] menu in hierarchical order"},{title:"Add page to menu",name:"add-page-to-menu",description:"Add the [page title] page to the menu"},{title:"Delete menu",name:"delete-menu",description:"Delete the [menu name] menu"}];function eie(e){const t=new Map,n=[];return e.forEach(r=>{t.set(r.id,{...r,children:[]})}),e.forEach(r=>{const o=t.get(r.id);if(r.parent===0)n.push(o);else{const i=t.get(r.parent);i&&i.children.push(o)}}),{itemsMap:t,rootItems:n}}const IS="wp://menus/list",tie="WordPress Menus List",PS="wp://menus/locations",nie="WordPress Menu Locations",nc="wp://menus/{menuId}/items",rie="WordPress Menu Items";function oie(e){e.resource(tie,IS,{title:"WP Menus List",description:"Complete list of all navigation menus on the site with their IDs, names, slugs, locations, and item counts. Use this to discover available menu IDs before assigning menus to locations or performing menu operations."},async t=>{console.log(`[WordPress Menu Server] Resource accessed: ${IS}`);try{const r=(await B("/wp/v2/menus","GET")).data;return{contents:[{uri:t.href,mimeType:"application/json",text:JSON.stringify(r,null,2)}]}}catch(n){return{contents:[{uri:t.href,mimeType:"application/json",text:JSON.stringify({error:"Failed to retrieve menus",message:n.message},null,2)}]}}}),e.resource(nie,PS,{title:"WP Menu Locations",description:'All available theme-defined menu locations with their identifiers and descriptions. Use this to get the exact location keys (e.g., "menu-1", "primary") needed for assigning menus to locations.'},async t=>{console.log(`[WordPress Menu Server] Resource accessed: ${PS}`);try{const r=(await B("/wp/v2/menu-locations","GET")).data;return{contents:[{uri:t.href,mimeType:"application/json",text:JSON.stringify(r,null,2)}]}}catch(n){return{contents:[{uri:t.href,mimeType:"application/json",text:JSON.stringify({error:"Failed to retrieve menu locations",message:n.message},null,2)}]}}}),e.resource(rie,new Xr(nc,{list:void 0}),{title:"WP Menu Items",description:'All menu items for a specific menu including their properties (id, title, url, type, parent, menu_order, target, classes, etc.). Returns { items: [...], hierarchy: [...] } where "items" is a flat list of all menu items and "hierarchy" shows the parent-child relationships. The "type" field indicates the item type: "custom" (custom link), "post_type" (page/post), or "taxonomy" (category/tag).'},async(t,n)=>{console.log("[WordPress Menu Server] Menu items resource variables:",n);let r=Array.isArray(n.menuId)?n.menuId[0]:n.menuId;typeof r=="string"&&(r=decodeURIComponent(r).replace(/[{}]/g,""));const o=parseInt(String(r),10);if(!o||isNaN(o)||o<=0)throw new Error(`Invalid menu ID: ${r}. Expected a positive number, got: ${JSON.stringify(n)}`);if(o>Number.MAX_SAFE_INTEGER)throw new Error(`Menu ID too large: ${o}`);console.log(`[WordPress Menu Server] Resource accessed: ${nc} for menu ${o}`);try{const s=(await B(`/wp/v2/menu-items?menus=${o}&per_page=100&orderby=menu_order&order=asc`,"GET")).data,{rootItems:a}=eie(s);return{contents:[{uri:t.href,mimeType:"application/json",text:JSON.stringify({items:s,hierarchy:a},null,2)}]}}catch(i){return{contents:[{uri:t.href,mimeType:"application/json",text:JSON.stringify({error:"Failed to retrieve menu items",message:i.message},null,2)}]}}})}function iie(){const e=new mt({name:"wp-menu-server",version:"1.0.0",title:"WP Menu"},{instructions:`## WordPress Menu Management ### Important WordPress Menu Concepts **Menu Item Types:** WordPress menu items have different types that determine how they work: - **"custom"** - Custom links with editable URLs - **"post_type"** - Links to pages or posts (URL is determined by the page/post and cannot be edited). When adding a page, use wpObjectType="post_type" with object="page" - **"taxonomy"** - Links to categories or tags (URL is determined by the taxonomy term). When adding a category, use wpObjectType="taxonomy" with object="category" **URL Editing Limitations:** You can only edit the URL of "custom" menu items (wpObjectType="custom"). For "post_type" or "taxonomy" items, the URL is automatically generated by WordPress based on the linked content and cannot be changed. If a user wants a different URL for a page/post menu item, you must create a new custom link with the desired URL. The old item will remain unless the user explicitly asks to delete it. ### Capabilities: **Menu Creation & Management:** - Create new menus with custom names - Add menu items linking to: - Pages - Posts - Custom URLs (including social media links) - Categories - Update menu properties and descriptions **Menu Item Operations:** - Add new items to existing menus - Reorder menu items to change display sequence - Update menu item properties (labels, URLs, etc.) - Create hierarchical menu structures (submenus) - Remove individual menu items - Delete entire menus **Menu Organization:** - Retrieve all items from specific menus - Display menu hierarchy and order - Manage parent-child relationships ### Limitations: - **Active menu detection**: Cannot identify which menus are currently displayed on the frontend - **Location verification**: Cannot verify where menus appear to site visitors - **Multi-location menus**: Cannot specify which menu appears on different pages - **Menu visibility**: Cannot set conditional display rules - **Mobile menu settings**: Cannot configure mobile-specific menu behaviors - **Menu styling**: Cannot apply custom CSS or styling to menus`,capabilities:{resources:{subscribe:!0}}});return oie(e),e.registerTool("wp-get-menus",{description:"Lists all navigation menus with their IDs, names, locations, and item counts. Use when you need to present menu information to the user in a readable format, or when you want to optionally exclude locations or counts from the response.",inputSchema:{includeLocations:Y().optional().default(!0).describe("Whether to include location assignments for each menu"),includeCount:Y().optional().default(!0).describe("Whether to include the number of items in each menu")},annotations:{title:"WP Get Menus",[Ee]:!0}},async({includeLocations:t,includeCount:n})=>{console.log("[WordPress Menu Server] wp-get-menus",{includeLocations:t,includeCount:n});try{const i=(await B("/wp/v2/menus","GET")).data.map(s=>{const a={id:s.id,name:s.name,slug:s.slug,description:s.description};return t&&(a.locations=s.locations),n&&(a.count=s.count),a});return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}catch(r){throw console.error("[WordPress Menu Server] wp-get-menus error:",r),new Error(`Error retrieving menus: ${r.message}`)}}),e.registerTool("wp-create-menu",{description:"Creates a new navigation menu with the specified name and optionally assigns it to theme locations. Use this tool when you need to create a new navigation menu structure. The menu will be created empty and you can then add menu items using wp-create-menu-item. You can optionally assign the menu to specific theme locations during creation.",inputSchema:{name:b().describe("The name of the menu to create"),description:b().optional().describe("Optional description for the menu"),locations:te(b()).optional().describe('Array of theme location names to assign this menu to (e.g., ["primary", "footer"])'),autoAdd:Y().optional().default(!1).describe("Whether to automatically add new top-level pages to this menu")},annotations:{title:"WP Create Menu"}},async({name:t,description:n,locations:r,autoAdd:o})=>{console.log("[WordPress Menu Server] wp-create-menu",{name:t,description:n,locations:r,autoAdd:o});try{const i={name:t,auto_add:o};n&&(i.description=n),r&&r.length>0&&(i.locations=r);const a=(await B("/wp/v2/menus","POST",i)).data;return Od(a,"Menu","create"),{content:[{type:"text",text:JSON.stringify({success:!0,message:"Menu created successfully",menu:{id:a.id,name:a.name,slug:a.slug,description:a.description||"",locations:r||[],auto_add:a.auto_add}},null,2)}]}}catch(i){throw console.error("[WordPress Menu Server] wp-create-menu error:",i),new Error(`Error creating menu: ${i.message}`)}}),e.registerTool("wp-update-menu",{description:"Updates a menu's name, description, or auto-add settings. Use when the user wants to rename a menu or change its properties. Note: This does NOT modify menu items or locations - use wp-assign-menu-location for locations.",inputSchema:{id:M().describe("The ID of the menu to update"),name:b().optional().describe("New name for the menu"),description:b().optional().describe("New description for the menu"),locations:te(b()).optional().describe("Array of theme location names to assign this menu to (replaces existing locations)"),autoAdd:Y().optional().describe("Whether to automatically add new top-level pages to this menu")},annotations:{title:"WP Update Menu"}},async({id:t,name:n,description:r,locations:o,autoAdd:i})=>{console.log("[WordPress Menu Server] wp-update-menu",{id:t,name:n,description:r,locations:o,autoAdd:i});try{const s={};n!==void 0&&(s.name=n),r!==void 0&&(s.description=r),o!==void 0&&(s.locations=o),i!==void 0&&(s.auto_add=i);const l=(await B(`/wp/v2/menus/${t}`,"PUT",s)).data;return Od(l,"Menu","update"),{content:[{type:"text",text:JSON.stringify({success:!0,message:"Menu updated successfully",menu:{id:l.id,name:l.name,slug:l.slug,description:l.description||"",locations:l.locations||[],auto_add:l.auto_add}},null,2)}]}}catch(s){throw console.error("[WordPress Menu Server] wp-update-menu error:",s),new Error(`Error updating menu ${t}: ${s.message}`)}}),e.registerTool("wp-delete-menus",{description:"Permanently deletes entire menus and all their items. Use when the user wants to remove menus completely. Supports deleting multiple menus at once. Cannot be undone.",inputSchema:{ids:te(M()).describe("The IDs of the menus to delete"),force:Y().optional().default(!0).describe("Whether to bypass trash and force deletion. Menus require force=true for deletion."),confirmationMessage:b().describe(`A clear explanation of what will be deleted and its impact (this would be shown to the user before deletion to ensure they understand the consequences of this irreversible action). Example: "You're about to permanently delete 3 navigation menus. This action cannot be undone and will remove all menu items, affecting your site's navigation structure."`)},annotations:{title:"Delete Menus",destructiveHint:!0}},async({ids:t,force:n})=>{console.log("[WordPress Menu Server] wp-delete-menus",{ids:t,force:n});const r=async o=>{try{const s=(await B(`/wp/v2/menus/${o}`,"GET")).data,a=`/wp/v2/menus/${o}${n?"?force=true":""}`;return await B(a,"DELETE"),await OL("/wp/v2/menus",o,`Menu "${s.name}"`,["rest_term_invalid","rest_no_route"]),{id:o,success:!0,name:s.name||"Unnamed Menu",error:null}}catch(i){return console.error(`[WordPress Menu Server] wp-delete-menu error for ID ${o}:`,i),{id:o,success:!1,name:null,error:i.message}}};try{const o=t.map(u=>r(u)),s=(await Promise.allSettled(o)).map(u=>{var d;return u.status==="fulfilled"?u.value:{id:0,success:!1,name:null,error:((d=u.reason)==null?void 0:d.message)||"Unknown error"}}),a=s.filter(u=>u.success),l=s.filter(u=>!u.success),c={success:l.length===0,message:l.length===0?`All ${t.length} menus deleted successfully`:`${a.length} of ${t.length} menus deleted successfully, ${l.length} failed`,total_menus:t.length,successful_deletions:a.length,failed_deletions:l.length,deleted_menus:a.map(u=>({id:u.id,name:u.name})),failed_menus:l.map(u=>({id:u.id,error:u.error}))};return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}catch(o){throw console.error("[WordPress Menu Server] wp-delete-menus error:",o),new Error(`Error deleting menus: ${o.message}`)}}),e.registerTool("wp-create-menu-item",{description:`Adds a new menu item to a menu. Use when: 1. User wants to add a page/post/category/custom link to a menu 2. User wants to change the URL of a page/post menu item (wpObjectType "post_type" or "taxonomy") - you MUST create a new custom link instead because WordPress doesn't allow changing URLs for these types IMPORTANT: If you're creating a custom link to replace a page/post item (scenario 2), you MUST explain to the user WHY in your response: "I've created a new custom link for you. The original '[item name]' was a WordPress page/post link (not a custom link), so its URL is automatically determined by WordPress and cannot be changed. The new custom link points to [new URL] as you requested. If you'd like to remove the old item, just let me know."`,inputSchema:{menuId:M().describe("The ID of the menu to add the item to"),title:b().describe("Display title for the menu item"),wpObjectType:ve(["post_type","taxonomy","custom"]).describe('WordPress object type category. Use "post_type" for pages/posts, "taxonomy" for categories/tags, "custom" for custom links.').transform(t=>t.toLowerCase()),object:b().optional().describe('Specific object within the wpObjectType. Required for post_type and taxonomy items. Examples: "page" (for pages), "post" (for posts), "category" (for categories), "tag" (for tags).'),objectId:M().optional().describe("ID of the object (page ID, post ID, category ID, etc.). Required for post_type and taxonomy items"),url:b().optional().describe("Custom URL for the menu item. Required for custom type items"),description:b().optional().describe(`Description text for the menu item. ${ru}`),parent:M().optional().default(0).describe("Parent menu item ID for creating sub-menu items. Use 0 for top-level items. Check the menu items resource to see valid parent IDs."),menuOrder:M().optional().describe("Order position of the item in the menu. If not specified, will be added at the end. Check the menu items resource to see current order."),target:b().optional().describe('Link target: "_blank" for new window, "_self" for same window'),classes:te(b()).optional().describe("CSS classes to add to the menu item"),attrTitle:b().optional().describe("Title attribute for the link (tooltip text)"),xfn:b().optional().describe("XFN relationship attributes for the link")},annotations:{title:"Create Menu Item"},_meta:{[Ie]:[{uri:nc,whenToUse:"When setting parent or menuOrder parameters",params:{menuId:"The menu ID parameter value"}}]}},async({menuId:t,title:n,wpObjectType:r,object:o,objectId:i,url:s,description:a,parent:l,menuOrder:c,target:u,classes:d,attrTitle:p,xfn:m})=>{var h;console.log("[WordPress Menu Server] wp-create-menu-item",{menuId:t,title:n,wpObjectType:r,object:o,objectId:i,url:s});try{const w={title:n,type:r,menus:t,status:"publish",parent:l||0};if(r==="post_type"||r==="taxonomy"){if(!o||i===void 0)throw new Error(`object and objectId are required for wpObjectType="${r}". Example: For a page, use wpObjectType="post_type", object="page", objectId=. For a post, use wpObjectType="post_type", object="post", objectId=`);w.object=o,w.object_id=i}else if(r==="custom"){if(!s)throw new Error("url is required for custom menu items");w.url=s}a&&(w.description=a),c!==void 0&&(w.menu_order=c),u&&(w.target=u),d&&d.length>0&&(w.classes=d),p&&(w.attr_title=p),m&&(w.xfn=m);const f=(await B("/wp/v2/menu-items","POST",w)).data;return Od(f,"Menu item","create"),{content:[{type:"text",text:JSON.stringify({success:!0,message:"Menu item created successfully",menu_item:{id:f.id,title:((h=f.title)==null?void 0:h.rendered)||n,menu_id:t,wpObjectType:r,url:f.url||s,parent:f.parent,menu_order:f.menu_order}},null,2)}]}}catch(w){throw console.error("[WordPress Menu Server] wp-create-menu-item error:",w),new Error(`Error creating menu item: ${w.message}`)}}),e.registerTool("wp-update-menu-item",{description:`Updates a menu item's properties (title, order, parent, URL). IMPORTANT: Before using this tool, check the menu items resource to see the item's "type" field. If the user wants to change the URL and the type is NOT "custom", DO NOT use this tool - use wp-create-menu-item instead to create a new custom link.`,inputSchema:{id:M().describe("The ID of the menu item to update"),menuId:M().describe("The ID of the menu containing this item (used to load the menu items resource)"),title:b().optional().describe("New display title for the menu item"),url:b().optional().describe("New URL for the menu item (for custom links)"),description:b().optional().describe("New description text for the menu item"),parent:M().optional().describe("New parent menu item ID for changing sub-menu relationships"),menuOrder:M().optional().describe("New order position of the item in the menu"),target:b().optional().describe('New link target: "_blank" for new window, "_self" for same window'),classes:te(b()).optional().describe("New CSS classes to add to the menu item"),attrTitle:b().optional().describe("New title attribute for the link (tooltip text)"),xfn:b().optional().describe("New XFN relationship attributes for the link")},annotations:{title:"Update Menu Item"},_meta:{[Ie]:[{uri:nc,whenToUse:`Always load to check the item's "type" field before updating (especially for URL changes), and to see valid parent IDs and current menu_order values when setting parent or menuOrder parameters`,params:{menuId:"The menu ID parameter value"}}]}},async({id:t,title:n,url:r,description:o,parent:i,menuOrder:s,target:a,classes:l,attrTitle:c,xfn:u})=>{var d,p,m,h,w;console.log("[WordPress Menu Server] wp-update-menu-item",{id:t,title:n,url:r,parent:i,menuOrder:s});try{if(r!==void 0){const _=(await B(`/wp/v2/menu-items/${t}`,"GET")).data;if(_.type!=="custom")throw new Error(`Cannot update URL: Menu item "${(d=_.title)==null?void 0:d.rendered}" is type "${_.type}" (linked to WordPress ${_.type==="post_type"?"page/post":"category/tag"}), not "custom". WordPress doesn't allow changing URLs for these types. SOLUTION: Create a new custom link instead: 1. Explain to the user: "I can't change the URL directly because '${(p=_.title)==null?void 0:p.rendered}' is linked to a WordPress ${_.type==="post_type"?"page/post":"category/tag"}. I'll create a new custom link with your URL instead." 2. Use wp-create-menu-item with: - menuId: ${t} - title: "${n||((m=_.title)==null?void 0:m.rendered)}" - type: "custom" - url: "${r}" - parent: ${_.parent} - menuOrder: ${_.menu_order} 3. After creating successfully, tell the user: "The new menu item has been created. If you'd like to remove the old '${(h=_.title)==null?void 0:h.rendered}' item, let me know and I can delete it." DO NOT automatically run wp-delete-menu-items. Only mention deletion as an option for the user.`)}const v={};n!==void 0&&(v.title=n),r!==void 0&&(v.url=r),o!==void 0&&(v.description=o),i!==void 0&&(v.parent=i),s!==void 0&&(v.menu_order=s),a!==void 0&&(v.target=a),l!==void 0&&(v.classes=l),c!==void 0&&(v.attr_title=c),u!==void 0&&(v.xfn=u);const g=(await B(`/wp/v2/menu-items/${t}`,"PUT",v)).data;return Od(g,"Menu item","update"),{content:[{type:"text",text:JSON.stringify({success:!0,message:"Menu item updated successfully",menu_item:{id:g.id,title:(w=g.title)==null?void 0:w.rendered,url:g.url,parent:g.parent,menu_order:g.menu_order,type:g.type}},null,2)}]}}catch(v){throw console.error("[WordPress Menu Server] wp-update-menu-item error:",v),new Error(`Error updating menu item ${t}: ${v.message}`)}}),e.registerTool("wp-delete-menu-items",{description:"Permanently deletes menu items. Use ONLY when the user explicitly requests deletion. Cannot be undone.",inputSchema:{menuId:M().describe("The ID of the menu containing the items to delete (used to load menu items resource)"),ids:te(M()).describe("The IDs of the menu items to delete. Get these from the menu items resource."),confirmationMessage:b().describe("A clear, user-friendly message shown in the confirmation dialog. Include item titles and impact. Make it clear the user can click Cancel.")},annotations:{title:"Delete Menu Items",destructiveHint:!0},_meta:{[Ie]:[{uri:nc,whenToUse:"Load to see item titles and check for child items before deletion to create accurate confirmation message",params:{menuId:"The menu ID parameter value"}}]}},async({menuId:t,ids:n})=>{console.log("[WordPress Menu Server] wp-delete-menu-items",{menuId:t,ids:n});const r=async o=>{var i,s;try{const l=(await B(`/wp/v2/menu-items/${o}`,"GET")).data;return await B(`/wp/v2/menu-items/${o}?force=true`,"DELETE"),await OL("/wp/v2/menu-items",o,`Menu item "${(i=l.title)==null?void 0:i.rendered}"`,["rest_post_invalid_id","rest_no_route"]),{id:o,success:!0,title:(s=l.title)==null?void 0:s.rendered,error:null}}catch(a){return console.error(`[WordPress Menu Server] wp-delete-menu-item error for ID ${o}:`,a),{id:o,success:!1,title:null,error:a.message}}};try{const o=n.map(u=>r(u)),s=(await Promise.allSettled(o)).map(u=>{var d;return u.status==="fulfilled"?u.value:{id:0,success:!1,title:null,error:((d=u.reason)==null?void 0:d.message)||"Unknown error"}}),a=s.filter(u=>u.success),l=s.filter(u=>!u.success),c={success:l.length===0,message:l.length===0?`All ${n.length} menu items deleted successfully`:`${a.length} of ${n.length} menu items deleted successfully, ${l.length} failed`,total_items:n.length,successful_deletions:a.length,failed_deletions:l.length,deleted_items:a.map(u=>({id:u.id,title:u.title})),failed_items:l.map(u=>({id:u.id,error:u.error}))};return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}catch(o){throw console.error("[WordPress Menu Server] wp-delete-menu-items error:",o),new Error(`Error deleting menu items: ${o.message}`)}}),e.registerTool("wp-reorder-menu-items",{description:"Changes the order or hierarchy of menu items in bulk. Use when the user wants to: move items up/down in the menu, create/remove sub-menus by changing parent relationships, or reorganize the entire menu structure. This is more efficient than updating items one by one.",inputSchema:{menuId:M().describe("The ID of the menu containing the items to reorder"),items:te(fe({id:M().describe("Menu item ID from the menu items resource"),menuOrder:M().describe("New order position"),parent:M().optional().default(0).describe("Parent menu item ID (0 for top-level)")})).describe("Array of menu item updates with new order and parent relationships. Get item IDs and current structure from the menu items resource.")},annotations:{title:"Reorder Menu Items"},_meta:{[Ie]:[{uri:nc,whenToUse:"Always load to see current menu structure, item IDs, and existing order before reordering",params:{menuId:"The menu ID parameter value"}}]}},async({menuId:t,items:n})=>{console.log("[WordPress Menu Server] wp-reorder-menu-items",{menuId:t,items:n});try{const r=n.map(o=>B(`/wp/v2/menu-items/${o.id}`,"PUT",{menu_order:o.menuOrder,parent:o.parent||0}));return await Promise.all(r),{content:[{type:"text",text:JSON.stringify({success:!0,message:"Menu items reordered successfully",menu_id:t,items_updated:n.length,updated_items:n},null,2)}]}}catch(r){throw console.error("[WordPress Menu Server] wp-reorder-menu-items error:",r),new Error(`Error reordering menu items: ${r.message}`)}}),e.registerTool("wp-assign-menu-location",{description:'Assigns a menu to a theme location (e.g., header, footer). Use when the user wants to control where a menu appears on the site. IMPORTANT: Use the location identifier from the menu locations resource (e.g., "menu-1"), NOT the display name (e.g., "Header").',inputSchema:{menuId:M().describe('The ID of the menu to assign. Find this from the menus list resource. If the user says "the menu" or "this menu", check context.wp_admin_fields.data.selectedField.value for the selected menu ID, or match the menu by name from the resource. NEVER guess or use arbitrary IDs.'),location:b().describe('The exact theme location identifier (key) from the menu locations resource. This must be the location key (e.g., "menu-1", "primary", "footer"), NOT the display name (e.g., not "Header" or "Footer Menu").'),replace:Y().optional().default(!1).describe("Whether to replace all existing location assignments (true) or add to existing ones (false)")},annotations:{title:"Assign Menu to Location"},_meta:{[Ie]:[{uri:IS,whenToUse:"Always load to get available menu IDs and names before assigning"},{uri:PS,whenToUse:"Always load to get the correct location identifiers before assigning a menu to a location"}]}},async({menuId:t,location:n,replace:r})=>{console.log("[WordPress Menu Server] wp-assign-menu-location",{menuId:t,location:n,replace:r});try{let o;if(r)o=[n];else{const c=(await B(`/wp/v2/menus/${t}`,"GET")).data.locations;o=c.includes(n)?c:[...c,n]}const s=(await B(`/wp/v2/menus/${t}`,"PUT",{locations:o})).data;return{content:[{type:"text",text:JSON.stringify({success:!0,message:r?"Menu location assignment replaced successfully":"Menu assigned to location successfully",menu:{id:t,name:s.name,locations:s.locations||[]},assigned_location:n,replace_mode:r},null,2)}]}}catch(o){throw console.error("[WordPress Menu Server] wp-assign-menu-location error:",o),new Error(`Error assigning menu ${t} to location ${n}: ${o.message}`)}}),e.registerTool("wp-get-site-hierarchy",{description:"Gets all pages and their parent-child relationships. Use when the user wants to create a menu based on the site structure, or when you need to find specific pages to add to a menu. Returns hierarchical page data that's useful for building navigation.",inputSchema:{postTypes:te(b()).optional().default(["page","post"]).describe("Post types to include in the hierarchy analysis"),includePosts:Y().optional().default(!1).describe("Whether to include blog posts in the analysis"),maxDepth:M().optional().default(3).describe("Maximum depth level to analyze in the hierarchy")},annotations:{title:"WP Get Site Hierarchy",[Ee]:!0}},async({postTypes:t,includePosts:n,maxDepth:r})=>{console.log("[WordPress Menu Server] wp-get-site-hierarchy",{postTypes:t,includePosts:n,maxDepth:r});try{const o={};for(const a of t){if(a==="post"&&!n)continue;const c=(await B(`/wp/v2/${a==="page"?"pages":a}?per_page=100&status=publish&orderby=menu_order&order=asc&_fields=id,title,slug,parent,menu_order,status`,"GET")).data,u=new Map;c.forEach(m=>{const h={id:m.id,title:m.title.rendered,slug:m.slug,parent:m.parent,menu_order:m.menu_order,status:m.status,type:a,level:0,children:[]};u.set(m.id,h)});const d=(m,h=0)=>h>=r?[]:m.map(w=>{w.level=h;const v=Array.from(u.values()).filter(f=>f.parent===w.id);return w.children=d(v,h+1),w}),p=Array.from(u.values()).filter(m=>m.parent===0);o[a]=d(p)}const i={total_post_types:t.length,hierarchy_depth:r,post_type_counts:{}};return Object.keys(o).forEach(a=>{const l=c=>c.reduce((u,d)=>u+1+l(d.children||[]),0);i.post_type_counts[a]=l(o[a])}),{content:[{type:"text",text:JSON.stringify({summary:i,hierarchy:o},null,2)}]}}catch(o){throw console.error("[WordPress Menu Server] wp-get-site-hierarchy error:",o),new Error(`Error analyzing site hierarchy: ${o.message}`)}}),wn("nav-menus.php")&&Qt(e,Qoe),e}function YL(){return`${Nd()}/mcp-apps/page-reload`}const JL=e=>`# Code Snippets — Instructions Local instructions override training knowledge. ## Unique Naming Convention (CRITICAL) - Namespace: \`AngieSnippets\\{PascalTitle}_{Id}\` → \`AngieSnippets\\PricingTable_456\` ${e} - Class: \`{Title}_{Id}\` → \`Pricing_Table_456\` - Widget get_name(): \`{snake_title}_{id}\` → \`pricing_table_456\` - Block name: \`angie-snippets/{slug}-{id}\` → \`angie-snippets/pricing-table-456\` - Display title (get_title): human-readable, NO ID suffix When editing, preserve existing naming. Never change the ID suffix. ## File Structure Each snippet folder: main.php (required), optional extra PHP/CSS/JS files. Located in \`wp-content/angie-snippets/dev/\` or \`wp-content/angie-snippets/prod/\`. ## Asset Enqueuing - Use \`angie_cs_get_snippet_asset_url( __FILE__, 'filename' )\` for URLs — NEVER \`plugin_dir_url()\` - Enqueue via \`wp_enqueue_scripts\` hook with \`wp_enqueue_style()\`/\`wp_enqueue_script()\` - Never hardcode \`